Is it possible to apply_filter on a wp_ajax_ action?

The question is: Is it possible to hook with apply_filters or add_filters on their function, manipulate it adding HTML to that page? apply_filters and add_filter() do two separate things. apply_filters allows a value to be filtered by add_filter(). This means that if the original code is 3rd-party, you can only use add_filter() if that code … Read more

cannot filter after using pre_get_posts

The problem is that you always set the meta query, if you don’t want it to apply in a particular situation, you need to check for that situation and account for it. Similar to how you’re already checking with is_admin, or is_main_query, etc. In this situation, you’ll want to check the $_GET parameters to detect … Read more

Two functions with different arguments and add_actions, but identical code

If I am not missing something here, you could have a third/main function, with two different wrappers for it. function wpse381184_main(){ //do your thing! } function acp_editing_saved_usage1( AC\Column $column, $post_id, $value ) { // call wpse381184_main() wpse381184_main(); } add_action( ‘acp/editing/saved’, ‘acp_editing_saved_usage’, 10, 3 ); function my_acf_save_post( $post_id ) { // call wpse381184_main() wpse381184_main(); } add_action(‘acf/save_post’, … Read more

Add and Remove Row Actions in an Existing WP_List_Table

As for the user rows in the Users list table (at wp-admin/users.php), you would use the user_row_actions hook like so: add_filter( ‘user_row_actions’, ‘my_user_row_actions’, 10, 2 ); function my_user_row_actions( $actions, $user_object ) { // Remove the Edit action. unset( $actions[‘edit’] ); // Add your custom action. $actions[‘my_action’] = ‘<a href=”<action URL>”>Action</a>’; return $actions; } The other … Read more

Gravity Forms parameters return 1

It’s not Gravity Forms, it’s ob_end_clean(), which just deletes the buffer and returns a boolean value. (In this case, true, which is getting expressed as 1.) Is there a pressing reason to use the ob_* functions? The code would be more readable (and predictable) if it was something like this. public function collectGFData($entry, $form ) … Read more

Delete data from database using row action

The “admin_action_{$_REQUEST[‘action’]}” hook does not pass any arguments. You would need to get the article_id from the $_REQUEST array. There are also a few other concerns such as: You’re not assigning an action when you call wp_create_nonce(). As Mafnah suggets in their ansewr, you should use $wpdb::delete() as a shortcut for using $wpdb::prepare(). Here’s how … Read more