January 4, 2019

How to tell SEOPress to analyze Oxygen’s Content

With the current incredible deal of $99 for unlimited lifetime usage of SEOPress Pro, many in the WordPress community (at least in the 10 or so Facebook groups that I hang around in) including me are jumping ship from Yoast.

Both Yoast and SEOPress have the feature of content analysis wherein you get to see how effectively your focus keyword has been used in the content with the corresponding suggestions to improve the onsite SEO score.

One issue is that only the content present in the WordPress editor is set to be read and parsed by these SEO plugins.

This means that on a site running Oxygen any content that is coming from the Oxygen editor will not be taken into consideration during the content analysis.

While Oxygen has built-in integration for Yoast to tackle this, it does not currently have something similar for SEOPress.

Thankfully, SEOPress provides a filter that lets us add any custom content to the WordPress content for it to analyze.

Let’s see how we can use this filter hook to instruct SEOPress to also parse the content in Oxygen editor.

Step 1

Install and activate Code Snippets plugin.

Step 2

Go to Snippets > Add New.

Title: Add Oxygen Builder’s Content to SEOPress’ analysis

Code:

add_filter( 'seopress_content_analysis_content', 'sp_content_analysis_content', 10, 2 );
/**
 * Filter the analyzed content to add content from Oxygen editor.
 * @param  string $content Current content in the WordPress editor.
 * @param  int $id      ID of the current entry.
 * @return string          Modified content.
 */
function sp_content_analysis_content( $content, $id ) {

    // HTML of Oxygen's content.
    $cf = do_shortcode( get_post_meta( $id, 'ct_builder_shortcodes', true ) );

    return $content . $cf;

}

Set it to run only in the admin.

That’s it!

Credit: Jan Raap.

Reference: https://wordpress.org/support/topic/it-doesnt-recognize-oxygen-texts/

Skip to toolbar