Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Phi Phan

    (@mr2p)

    Hello @snoop23,

    This block supports displaying any field whose value can be retrieved by the core API (get_post_meta,?get_term_meta,?get_user_meta) and is a string or can be converted to a string. So if those Yoast meta keys can be retrieved via above core APIs then they can be displayed with this block. If they are not compatibble with core APIs, you also can disaplay them via custom code. I’m not familar with Yoast API to provide a final snippet but here is what the code might look like:

    add_filter( 'meta_field_block_get_block_content', function ( $block_content, $attributes, $block, $post_id, $object_type ) {
    $field_name = $attributes['fieldName'] ?? '';

    if ( 'your_field_name' === $field_name ) {
    // Using Yoast SEO API to get value here, then override the $block_content with your desired format.
    // $block_content = 'new value here';
    }

    return $block_content;
    }, 10, 5);

    Best, Phi.

    Thread Starter snoop23

    (@snoop23)

    Okay, cool. That’s very helpful.

    Thanks for the quick and detailed response. Much appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.