Is there a limit to hook priority?

There are no limits and no performance penalties. To understand why, you need to understand how all hooks are stored in the WP ecosystem. First of all you need to understand where all hooks are stored and how they do it. All hooks for filters and actions are stored in global variable called wp_filter, yes … Read more

What is “all” in isset($wp_filter[‘all’])

all is just a string the WordPress developers picked to behave differently than any other hook. When you attach to all, your callback will fire for all other hooks. I wouldn’t spend too much time looking at the source of do_action, just know that: add_action( ‘x’, ‘whatever’ ) will mean whatever fires for do_action( ‘x’ … Read more

Generate dormant hook references

There is no script or plugin that I know of to do what you want. As you have stated, there are scripts (even global variables) which you can use to print filters and actions currently being used. As for dormant filters and actions, I have written two very basic functions (with some help here and … Read more

Trigger custom action when setting button pressed

You need a second form with admin_url(‘admin-post.php’) as form action. Then you can hook into admin_post_custom_action to execute your action. Sample code: add_action( ‘admin_post_wpse_79898’, ‘wpse_79898_test’ ); function wpse_79898_test() { if ( isset ( $_GET[‘test’] ) ) echo esc_html( $_GET[‘test’] ); die( __FUNCTION__ ); } In your settings page: <form action=”<?php echo admin_url( ‘admin-post.php’ ); ?>”> … Read more

Action hook for custom tax edit

Look at wp-includes/taxonomy.php. The actions are: do_action( “create_term”, $term_id, $tt_id, $taxonomy ); do_action( “created_term”, $term_id, $tt_id, $taxonomy ); do_action( “edited_term”, $term_id, $tt_id, $taxonomy ); do_action( ‘delete_term’, $term, $tt_id, $taxonomy, $deleted_term ); do_action( “create_$taxonomy”, $term_id, $tt_id ); do_action( “created_$taxonomy”, $term_id, $tt_id ); do_action( “edited_$taxonomy”, $term_id, $tt_id ); do_action( “delete_$taxonomy”, $term, $tt_id, $deleted_term );

Is there any action filter/hook for validating a custom field before publishing the post?

At the beginning of wp_insert_post, the function that saves/updates a post, there is a filter called wp_insert_post_empty_content. By default this filter checks whether the title, editor, and excerpt fields are all empty, in which case the save process will be halted. However, since all the fields to be saved are passed to this filter, you … Read more

Set default image link target in Gutenberg image block

This was (finally) fixed to Gutenberg (and will be applicable for both the image and the gallery blocks); and will add an option to WordPress options’ database table. this was done in https://github.com/WordPress/gutenberg/pull/25578 and https://github.com/WordPress/gutenberg/pull/25582 It’ll be added to WordPress 5.6 but it’s already available in the Gutenberg plugin. To link the image to the … Read more

Move excerpt meta box to above content editor

It’s simple, just unregister postexcerpt box first then add another one on the top. Here is my code add_action( ‘admin_menu’, function () { remove_meta_box(‘postexcerpt’, ‘post’, ‘normal’); }, 999 ); add_action(‘edit_form_after_title’, ‘post_excerpt_meta_box’);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)