Unable to update Focus keyphrase in woocommerce product category using update_post_meta

96 views Asked by At

I am trying to update yoast focus keyphrase using the code below.

add_action( 'created_product_cat', 'ts_custom_woocommerce_placeholder', 10, 2 );
function ts_custom_woocommerce_placeholder( $post_id ) {
    $productname = 'test prduct'
    update_post_meta($post_id, '_yoast_wpseo_focuskw', $productname.' ecm');
    return true;
}

What am I missing here?

0

There are 0 answers