WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
Debugging Custom Fields (2 posts)

  1. areifers
    Member
    Posted 1 year ago #

    WordPress version: 3.4.2
    WordPress SEO version: 1.3.0
    Types : 1.1.3.1

    I did this:
    Created the following meta template for a custom post type in the taxonomies section of Yoast
    Blah blach %%cf_city%% blah blah vlah

    I expected the plugin to do this:
    The plugin to replace the %%cf_city%% tag with the value of the city custom field.

    Instead it did this:
    The %%cf_city%% was simply left blank in the meta description, rendering on the page as
    Blah blach blah blah vlah

    Simply to ensure I wasn't providing the wrong name, I have tried a large number of variations of cf_city, such as cf_wpcf-city, cf_City etc. I am hoping that I can be pointed down a path that could help me troubleshoot debug the issue.

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. areifers
    Member
    Posted 1 year ago #

    I was able to figure out the issue... Here's how.

    1: Stopped worrying about Yoast and just took a look at the custom fields on the custom type... I verified the information using the following code snippet provided by Justin Tadlock ( http://justintadlock.com/ ) a few years ago

    <?php
    $custom_fields = get_post_custom();

    foreach ( $custom_fields as $field_key => $field_values ) {
    foreach ( $field_values as $key => $value )
    echo $field_key . ' - ' . $value . '
    ';
    }
    ?>

    2. The value I was looking for was returned and it was in the list of items I tried in the page meta description. Specifically %%cf_wpcf-city%% was the field that worked when placed on the taxonomy but not on the post specific meta description. I thought this was odd, because my understanding was that you could use Yoast tags anywhere. If anyone has any comments or insight why it would not work on the post specific meta description but does work in the title and meta taxonomies meta template for the Custom Type post type I'd appreciate it. Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic