aiosp_opengraph_generate_descriptions_from_content

Need help with this?
Purchase All in One SEO Pack Pro to get dedicated support from us.

Buy Now

The All in One SEO Pack aiosp_opengraph_generate_descriptions_from_content filter hook.

Description

if ( ! AIOSEOPPRO || ( AIOSEOPPRO && apply_filters( ‘aiosp_opengraph_generate_descriptions_from_content’, true, $post ) ) ) {
$description = $post->post_content;
} else {
$description = $post->post_excerpt;
}

This filter can be used in conjunction with the Use Content For Autogenerated OG Descriptions option to control whether the excerpt or content is used for the autogenerated OG descriptions for a specific post type.

This is especially useful for users of WooCommerce who wish to use the Product Short Description for autogenerated OG descriptions as shown in the example code below.


Parameters (2)

0.(bool)
use content for autogenerated description if true.
1.$post (object)
the relevant post object.

Usage

add_filter( 'aiosp_opengraph_generate_descriptions_from_content', 'aiosp_opengraph_generate_descriptions_from_content', 10, 2 );

function aiosp_opengraph_generate_descriptions_from_content( $return, $post ) {
     if( $post->post_type  === 'product' ) {
          return false;
     } 
     return true;
}

Defined (1)

The filter is defined in the following location(s).

/modules/aioseop_opengraph.php

This hook was added in version 3.0 of All in One SEO Pack.

For instructions on how to use this code, please refer to our FAQ here.

  • Was this helpful ?
  • YesNo
[i]
[i]
Skip to toolbar