remove_action returns FALSE
Locate the original add_action call and make sure that your remove_action call exactly mimics it including the $priority and $accepted_args parameters.
Locate the original add_action call and make sure that your remove_action call exactly mimics it including the $priority and $accepted_args parameters.
It must be pretty late in the action order because I’ve tried hooking to admin_notices from it and it doesn’t work. $function callback (param of add_submenu_page) is used to output the content of admin pages, so it runs when WordPress is actually displaying the markup (body) of page. That should be pretty clear because you … Read more
You need a filter not an action. Something like this (notes are commented into the code. You have a few PHP errors that you need to correct): function signup_validate_insert($post){ $errors = false; if (isset($post[‘submit_msg’])) { // validate , insert into database } return $errors; } add_filter(‘signup_insert’, ‘signup_validate_insert’); $errors = apply_filters(‘signup_insert’, $_POST); if((!empty($errors))){ // $errors is … Read more
Well, the short answer is the first item consumes more memory then the second one. One of the reason would be that WordPress hooks uses call_user_func_array() to call al those functions dynamically. And call_user_func_array() actually takes an array as one of its parameter and do a search for a function with this name. So in … Read more
Essentially you want to remove this after it had been added, but before that hook fires. Which is hard to tell in general without knowing when does the parent theme executes this. Also in often confusing way functions.php of child theme is loaded before that of parent theme. Often makes timing of things counter–intuitive. The … Read more
You’re thinking about this entirely wrong. A meta tag isn’t something you add when a post gets saved, it’s something that gets added to the output when a post is viewed. So instead of trying to hook the action inside save_post, you hook it on every page load, and inside the hook you check if … Read more
You’re partly there. This is the code you should be using: add_action( ‘publish_post’, array( $myClass ,’dothisfunction’ ), 10, 2 ); You can’t pass parameters to the action that’s being executed. You can only “hook” into the action after do_action is called, and whatever parameters have been added to that action. If there are particular variables … Read more
You have to use new_to_publish action as described on Post Status Transitions Codex page (updated according @prog comment): add_action( ‘new_to_publish’, ‘pms_post_published_notification’, 10, 1 ); function pms_post_published_notification( $post ) { if( ‘property’ === $post->post_type ) { // custom code here } } The only argument is passed to your function is $post object, so you can … Read more
Answer For removing an action hook use the same action name, callback name and priority that was used to add a action in parent theme. You should move the function from being defined in index.php to functions.php of the parent theme. Lastly, you could register the child function using init. So you end up with … Read more
Actually there is no hook there to change the texts on the fly. So the way is like below: Let’s first remove the default one, use the following code in functions.php: remove_action( ‘wp_head’, ‘wp_generator’ ); Now show our new one, add the following code in functions.php: function wpse_custom_generator_meta_tag() { echo ‘<meta name=”generator” content=”Mr. Kauwa Kala” … Read more