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

I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use: to register and/or enqueue scripts and styles on front- and back-ends? Questions: Which are right hooks to use? All front end register/enqueue scripts/styles in init? Why is there no admin_print_styles-{xxx}? 1 Why registering and queuing properly matters it … Read more

Is there a save_post hook for custom post types?

Is there a save_post hook for custom post types? Example: save_my_post_type I know there is publish_my_post_type but I’m looking for a save hook. 2 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 … Read more

How to get WordPress’ hooks/actions run sequence?

In what order add_action hooks execute? i.e. init wp_head wp_footer after_theme_setup etc… ??? ??? ??? EDIT: I’ve also posted my solution. 6 “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 … Read more

Passing a parameter to filter and action functions

Is a way to pass my own parameters to the function in add_filter or add_action. For example take a look in the following code: function my_content($content, $my_param) { do something… using $my_param here … return $content; } add_filter(‘the_content’, ‘my_content’, 10, 1); Can I pass my own parameter? something like: add_filter(‘the_content’, ‘my_content($my_param)’, 10, 1) or add_filter(‘the_content’, … Read more