Skip to content

Commit

Permalink
Stop Blaze & Copy quick links disappearing after using Quick Edit (#4…
Browse files Browse the repository at this point in the history
…0889)

The post list has a number of quick links including 'Promote with
Blaze', 'Copy' and Quick Edit. After using Quick Edit the Blaze and Copy
links go missing - they're not registered when the ajax response
includes the new quick links.

This is solved by registering the `post_row_actions` hook on the
admin-ajax.php page as well as the edit.php page.
  • Loading branch information
dsas authored Jan 8, 2025
1 parent 3dc2652 commit 4f99020
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Blaze: ensure post list quick link is added after quick edit
4 changes: 4 additions & 0 deletions projects/packages/blaze/src/class-blaze.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class Blaze {
public static function init() {
// On the edit screen, add a row action to promote the post.
add_action( 'load-edit.php', array( __CLASS__, 'add_post_links_actions' ) );
// After the quick-edit screen is processed, ensure the blaze row action is still present
if ( 'admin-ajax.php' === $GLOBALS['pagenow'] && ! empty( $_POST['screen'] ) && 'edit-post' === $_POST['screen'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce verification is not needed here, we're not saving anything.
self::add_post_links_actions();
}
// In the post editor, add a post-publish panel to allow promoting the post.
add_action( 'enqueue_block_editor_assets', array( __CLASS__, 'enqueue_block_editor_assets' ) );
// Add a Blaze Menu.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Post list: Ensure copy quick link is added after quick edit
2 changes: 1 addition & 1 deletion projects/plugins/jetpack/modules/copy-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Jetpack_Copy_Post {
* @return void
*/
public function __construct() {
if ( 'edit.php' === $GLOBALS['pagenow'] ) {
if ( 'edit.php' === $GLOBALS['pagenow'] || ( 'admin-ajax.php' === $GLOBALS['pagenow'] && ! empty( $_POST['screen'] ) && 'edit-post' === $_POST['screen'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- update_post_data() handles access check.
add_action( 'admin_head', array( $this, 'print_inline_styles' ) );
add_filter( 'post_row_actions', array( $this, 'add_row_action' ), 10, 2 );
add_filter( 'page_row_actions', array( $this, 'add_row_action' ), 10, 2 );
Expand Down

0 comments on commit 4f99020

Please sign in to comment.