Filters to Support CPTs for Blog Meta and Single Blog Meta
|
/ Documentation /Custom Code Snippets/Blog Filters/ Filters to Support CPTs for Blog Meta and Single Blog Meta

Filters to Support CPTs for Blog Meta and Single Blog Meta

You can add the following filters to insert Blog Meta and Single Blog Meta to the Custom Post Types ( CPTs ) in the child theme’s functions.php –-

/*
 * Filters to support meta-structure for CPT Single Posts & Archive
 */

add_filter( 'astra_blog_archive_post_type_meta', 'astra_blog_archive_post_type_meta_func' );

function astra_blog_archive_post_type_meta_func( $post_type_array ) {
    array_push( $post_type_array, 'movies' ); //Here movies is the slug of CPT, you will need to update with the respective slug of your CPT
    return $post_type_array;
}

add_filter( 'astra_single_post_type_meta', 'astra_single_post_type_meta_func' );

function astra_single_post_type_meta_func( $post_type_array ) {
    array_push( $post_type_array, 'movies' ); //Here movies is the slug of CPT, you will need to update with the respective slug of your CPT
    return $post_type_array;
}

Note

Refer this doc on How to Add Custom PHP Code?

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

This field is required.

REWIND

YEAR IN REVIEW

Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form