Auto delete comment if Contains

It is better to use ‘comment_post’ action for this purpose, it is fired when the comment is saved in database: add_action(‘comment_post’, ‘my_comment_post_callback’, 10, 3); function my_comment_post_callback($comment_id, $comment_approved, $commentdata) { if (strpos($commentdata[‘comment_content’], ‘dog’) !== false) { $post_url = get_permalink($commentdata[‘comment_post_ID’]); wp_delete_comment($comment_id, true); wp_redirect($post_url); exit; } }

Edit WooCommerce product content based on category

There’s a couple of ways to do it, you can edit the template file \woocommerce\templates\single-product\title.php directly and change your title format there. Otherwise, you can remove the WordPress hook in your functions.php file and add your own to override it which I borrowed from this answer <?php remove_action( ‘woocommerce_single_product_summary’,’woocommerce_template_single_title’, 5 ); add_action( ‘woocommerce_single_product_summary’, ‘modify_woocommerce_template_single_title’,5 ); … Read more

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name

I would start by creating in the themes functions.php a function like this public function greenday_head($args) { return $args } It may be that $args are never passed in but it seems likely they are. If you want to try to find out what this is doing then you can add: public function greenday_head($args) { … Read more

Changing post content on save, using updated fields

Try to use the post object provided by the action as the second parameter instead of getting it from database: function change_event_slug_on_save( $post_id, $post ) { … } add_action( ‘save_post’, ‘change_event_slug_on_save’, 10, 2 ); With this you can remove the line $post = get_post($post_id); EDIT: Tribe Events Calendar has it’s own actions for saving an … Read more