Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter taylorthain

    (@taylorthain)

    Thanks! the update to 6.4.1 did fix it! I do use a page builder but that doesn’t seem to be an issue.

    Thread Starter taylorthain

    (@taylorthain)

    Hey Team! Thanks for the replies. The suggested fix from @rainbowgeek was the right direction. I actually managed to find it myself a couple hours before this reply.

    That said, for anyone else who has a similar issue or is looking to solve this problem, the hook that was provided from the SEOpress documentation has a limitation that I didn’t like, in that it required me to specify every individual content field from the custom post type if i wanted it included in the analysis. This didn’t work for me as my post type has a multitude of content blocks in the editor.

    To solve for this, I edited the code. The following code will check if a post type is the PODs custom post type and then retrieve ALL Meta fields for the post type and make it readable to the plugin.

    Just swap out ‘your_custom_post’ with the name of your post from Pods and throw this in your functions document and that content should now be visible to the Analysis Metabox!

    add_action( 'wp_enqueue_scripts', 'wpbf_child_scripts', 13 );
    // SEOpress Content Analysis Expansion - Your Custom Post Type
    function sp_content_analysis_content($content, $id) {
        // Check if the post type is 'your_custom_post'
        $post_type = get_post_type($id);
        if ($post_type === 'your_custom_post') {
            // Retrieve all meta fields for the post
            $meta_fields = get_post_meta($id);
    
            // Append the field values to the original content
            foreach ($meta_fields as $key => $value) {
                $content .= $value[0];
            }
        }
    
        return $content;
    }
    add_filter('seopress_content_analysis_content', 'sp_content_analysis_content', 10, 2);
Viewing 2 replies - 1 through 2 (of 2 total)