How to remove the “+Add Category” button from the Category metabox?

I installed the ‘User Role Editor’ plugin and removed the ‘manage_categories’ capability for the ‘Editor’ which worked. But I would like to remove it for ALL users including admin, superadmin. If removing the ‘manage_categories’ capability from the editor role provides the functionality you want, then you can remove the ‘manage_categories’ capability from all user roles … Read more

Extend a class of a plugin

Woocommerce support sent me the solution of my problem: function unregister_parent_hook() { if ( function_exists( ‘wc_dve’ ) ) { $instance = wc_dve(); remove_action( ‘woocommerce_after_order_notes’, array( $instance, ‘exemption_field’ ) ); } }

How to run a function when post is edited or updated using publish post action?

With the post_updated hook you can trigger an action when the post is updated. He passes 3 parameters: $post_ID (the post ID), $post_after(the post object after the edit), $post_before (the post object before the edit) Here’s an example: <?php function check_values($post_ID, $post_after, $post_before){ echo ‘Post ID:’; var_dump($post_ID); echo ‘Post Object AFTER update:’; var_dump($post_after); echo ‘Post … Read more

How to remove a custom action on child theme?

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

Passing arguments to my function with do_action and add_action is not working

You are doing the do_action before the action is add, try moving it: $name = “link”; add_shortcode($name, ‘aa_link_shortcode’); function shorcode_resources($var1) { global $post; $shortcode_found = false; if (has_shortcode($post->post_content, $var1)) { $shortcode_found = true; } if ($shortcode_found) { wp_enqueue_style(‘core’, ABS_URL . ‘/shortcode/css/flipbox.css’, false); wp_enqueue_script(‘my-js’, ABS_URL . ‘/shortcode/js/flipbox(‘ . $var1 . ‘).js’, false); } } //first we … Read more

Detect when any plugin is activated or deactivated

There are few solutions. You can use activate_plugin and deactivate_plugin hooks for example. But… As far as I understand you right, you want to get notified whenever list of plugins get changed and not when a plugin is activated or deactivated. So the easiest way will be hooking onto update_option. add_action(‘updated_option’, function( $option_name, $old_value, $value … Read more

wp_transition_post_status does not change the status of the post

This function contains do_action() calls for post status transition action hooks. The order of the words in the function name might be confusing – it does not change the status of posts, it only calls actions that can be hooked into by plugin developers. https://codex.wordpress.org/Function_Reference/wp_transition_post_status What you want is wp_update_post, you’re also using WP_Query incorrectly: … Read more