• Resolved Rory Michael Heaney

    (@rorymheaney)


    I’m using Nuxt.js and for Vue-meta it’s recommended that each name/property has a corresponding “hid” value. Example:

    hid: "description", name: "description", contnet: ''

    or

    hid: 'og:title',property: "og:title", content: ''

    Is there a filter where I can amend a hid variable throughout based on either property and/or name?

    I do change this after it’s returned with a forEach statement (async-await promises), but just wondering if there’s an option to adjust from the start.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Richard Korthuis

    (@rockfire)

    Hi @rorymheaney

    Thank you for using our plugin!

    Yes, you could use the wp_rest_yoast_meta/filter_yoast_meta filter like this:

    /**
     * Add hid.
     */
    function wpym_add_hid( $yoast_meta ) {
        foreach( $yoast_meta as &$meta ) {
            $meta['hid'] = $meta['name'] ?: $meta['property'];
        }
    
        return $yoast_meta;
    }
    add_filter( 'wp_rest_yoast_meta/filter_yoast_meta', 'wpym_add_hid', 10, 1);

    N.B. I didn’t test this, so possibly you have to tweak it a little.

    Please let us know if this is what you wanted!

    Thread Starter Rory Michael Heaney

    (@rorymheaney)

    @rockfire Thank you so much!

    That is really appreciated. I use this and caching plugin and it has been awesome all around.

    Thank you again for that assistance, worked great.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Question (non issue)’ is closed to new replies.