New answers tagged

0

Step 1 - Register a Custom Query Var By adding a custom query var, you make WP aware of it so it can be used in requests. function wpse_add_query_vars( $vars ) { $vars[] = 'wpse_set_to_publish'; return $vars; } add_filter( 'query_vars', 'wpse_add_query_vars' ); Step 2 - Sniff The Request Now we hook into parse_request to look for our new custom ...


4

Looking at the sources (core files, wp-includes/option.php) you can always find your target hook tags: add_action("added_option", "wpse230212_callback_add", 10, 2); add_action("updated_option", "wpse230212_callback_update", 10, 3); function wpse230212_callback_add( $option_name, $option_value ) { } function wpse230212_callback_update( $option_name, $...


0

Hi thx for your answering ,but i confused shall I define one of stdclass objects like [menu] => Menu Name or [theme_location] => İf so,Is it neccessary to change Menu Name which on you typed [menu] => Menu Name Could u send me hole ordered codes,pls?


2

The wp_nav_menu_items filter has a secondary parameter that it passes: $args. What we need to do is set up our filter to accept second args by passing a priority 10 and the number of args 2: add_filter( 'wp_nav_menu_items', 'my_counter_nav_menu', 10, 2 ); Now that we're passing args - if we peek into what it holds we see the following object: stdClass ...



Top 50 recent answers are included