• Resolved bosmanict

    (@bosmanict)


    // Update the SEO description for the tag
    $result_desc = update_term_meta($tag_id,'_yoast_wpseo_metadesc', $seo_description);
    
            if (is_wp_error($result_desc)) {
                echo "Term meta update for SEO description failed with error: " . $result_desc->get_error_message();
            } else {
                echo "Term meta for SEO description updated successfully!";
            }

    Trying to update tag with above code, but it does not work. What could be the solution?

Viewing 1 replies (of 1 total)
  • Plugin Support Rohan Sadanandan

    (@rohans123)

    Hi @bosmanict

    Thanks for reaching out.

    The Yoast SEO plugin code documents the available developer filters for customizing many of our plugin features. We also have a developer portal with more information about filters and many examples of how to implement them.

    You or your developer can use the wpseo_metadesc filter to customize the meta description. Typically code snippets are added to your theme’s functions.php file. If you’re unfamiliar with using code snippets, we’d like to refer you to the WordPress documentation on how to use a filter.

    An example code snippet can be found here:
    https://developer.yoast.com/features/seo-tags/descriptions/api/

    In the example code, you can use is_tag() and get_term_meta() functions according to your requirements.

Viewing 1 replies (of 1 total)
  • The topic ‘Update tag_id title / description with PHP does not work’ is closed to new replies.