• Resolved Argumentum

    (@argumentum0)


    Hello,

    I would like to retrieve the meta description that is automatically generated by SEO Framework. Is it possible?

    I have tried to retrieve it with:

    get_post_meta( $post_id, '_genesis_description', true );

    But the result was nothing. I suppose the field _genesis_description is used only when we enter a description manually?

    How can I retrieve the automatically generated meta description?

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    That’s correct. We only store inputted information; we don’t save auto-generated information, TSF regenerates those every request.

    To get the active description for the current query, use this:

    $desc = function_exists( 'the_seo_framework' ) ? the_seo_framework()->get_description() : '';
    

    If you want to get only the generated description for the current query, use this:

    $desc = function_exists( 'the_seo_framework' ) ? the_seo_framework()->get_generated_description() : '';
    

    For most of our meta-getter-methods, we use the input parameter $args.
    For example, to get the active description for an external page, please use this:

    $args = [
    	'id'       => 42,
    	'taxonomy' => '',
    ];
    $desc = function_exists( 'the_seo_framework' ) ? the_seo_framework()->get_description( $args ) : '';

    The same input works for almost all description, title, URL, and soon (v4.0) also the robots and image getters. The structured-data getters are the last cohere (ETA v4.1).

    There’s no need for method_exists() checks on the_seo_framework() object. We implemented a plethora of failsafe so we can change the API with a peace of mind; the object will notify you when there’s an issue.

    I hope this helps! Cheers 🙂

    • This reply was modified 5 years, 1 month ago by Sybre Waaijer. Reason: Additional information

    thank you very much

    Thread Starter Argumentum

    (@argumentum0)

    Thanks for the great support (and product), Sybre! That is exactly what I needed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Retrieving the automatically generated meta description’ is closed to new replies.