How to add rewrite rule for product compare page?

Here you go: compare\/([^-vs-]*)(?:-vs-)([^-vs-]*)(?:-vs-)?([^-vs-]*)? Remember to escape backslashes (as I have done). I also made your lookups more consistent in their internal logic/structure. I assumed you wouldn’t want a second -vs- if the third product wasn’t there, so this is why you now have the second non-capturing group. Here is a link with the answer … Read more

How would I correctly implement a new if statement in a child functions file?

you put a , instead of ; at end of $advert_details. you will better see this kind of error if you better indent the code. add_action(‘wp_enqueue_scripts’, ‘theme_enqueue_styles’, 12); function theme_enqueue_styles() { wp_enqueue_style(‘parent-style’, get_template_directory_uri() . ‘/style.css’); } if (!function_exists(‘adifier_custom_meta’)) { function adifier_custom_meta() { $meta_boxes = array(); $advert_details = array( array( ‘id’ => ‘advert_cond’, ‘name’ => esc_html__( … Read more

Send email notification when post type product is publish from pending status

You were close. The hook, you’re trying to use, is called from function wp_transition_post_status(): function wp_transition_post_status( $new_status, $old_status, $post ) { // // … // do_action( “{$new_status}_{$post->post_type}”, $post->ID, $post ); } So, to execute code when product status changes add function to hook publish_product. The first argument passed to the function is $post_id, not WP_Post … Read more