Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 16037

Method by which plugins and themes extend core WordPress functionality.

2 votes
1 answer
826 views

template_redirect not being called when using ajax

Usually I hook all my custom plugins code with the template_redirect hook but one of the issue I encountered is it does not work for the ajax call. So if I want to target both standard calls and ajax …
Yoga's user avatar
  • 919
1 vote
1 answer
1k views

Remove rewrite rules generated by plugin during deactivation‎

I have a simple plugin like the following add_action('generate_rewrite_rules', function ($wp_rewrite) { $wp_rewrite->rules = xxx + $wp_rewrite->rules; }); if (is_admin()) { register_activati …
Yoga's user avatar
  • 919
1 vote
3 answers
181 views

What are the benefit in adding hook in the init() hook?

I see a lot of plugins using this approach to add a new hook, e.g. add_action('init', function() { add_action('SOME_LATER_HOOK', xxx); add_filter('SOME_LATER_FILTER', yyy); }); Why they don't …
Yoga's user avatar
  • 919
1 vote
2 answers
632 views

Failed to invoke other hook from the init hook

Related to this question (Use wp init hook to call other hooks?) but not the same. Sometimes, I found that the hook will failed to run when I place inside the init hook, e.g. … Of course some hooks/filters will just work okay inside the init hook, but definitely not all of them. So it seems to me that it is a bad practice to chain actions/filters together? …
Yoga's user avatar
  • 919
1 vote
1 answer
1k views

How to initialize something in unit test before the init hook being called?

I've a simple PHP Unit written for WordPress and want the initialize code before the main 'init' action being called from the plugin I want to test, e.g. class MyPlugin_Test_Example extends WP_UnitTe …
Yoga's user avatar
  • 919
0 votes
1 answer
2k views

How to get menu location in wp_update_nav_menu hook

I want to get the menu location in the wp_update_nav_menu (during menu save action) add_action('wp_update_nav_menu', function ($id, $data = NULL) { error_log( var_export($data, true) ); …
Yoga's user avatar
  • 919