Are there any hooks that alter the 404 logic?

After a bit more slogging through code and Googling, I found the answer. It’s contained in this thread (see Otto42’s post), but for the record, adding the following to your plugin will override the 404 handling for the conditions you specify: add_filter(‘template_redirect’, ‘my_404_override’ ); function my_404_override() { global $wp_query; if (<some condition is met>) { … Read more

How to know what functions are hooked to an action/filter?

Look into the global variable $wp_filter. See my plugin for a list of all comment filters for an example: <?php /* Plugin Name: List Comment Filters Description: List all comment filters on wp_footer Version: 1.1 Author: Fuxia Scholz License: GPL v2 */ add_action( ‘wp_footer’, ‘list_comment_filters’ ); function list_comment_filters() { global $wp_filter; $comment_filters = array (); … Read more

Where is the right place to register/enqueue scripts & styles

Why registering and queuing properly matters it should be in time – earlier than script/style is up for being output to page, otherwise it is too late; it should be conditional – otherwise you are loading stuff where you don’t need it and cause performance and functionality issues, for this you need WP environment loaded … Read more

Is there a save_post hook for custom post types?

the hook is the same save_post just make sure its your post type ex: add_action(‘save_post’,’save_post_callback’); function save_post_callback($post_id){ global $post; if ($post->post_type != ‘MY_CUSTOM_POST_TYPE_NAME’){ return; } //if you get here then it’s your post type so do your thing…. }

Where can I find a list of WordPress hooks?

@Arlen: As Keith S points out Adam Brown’s List of Hooks is the defacto resource of hooks for WordPress. However, it’s not perfect: It doesn’t show the hooks in order of when they are called, It doesn’t provide file name or line number where invoked, It doesn’t provide a number of arguments passed, It’s not … Read more

How to get WordPress’ hooks/actions run sequence?

“Data! Data! Data!” he cried impatiently. “I can’t make bricks without clay.” Sherlock Holmes – The Adventure of the Copper Beeches So let’s gather some real data from a vanilla WordPress 5.7.2 install and the TwentyTwelve theme activated with only a single Text widget. For the home page, the following do_action / do_action_ref_array calls are … Read more

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