Why SEOPress Doesn't Analyze WooCommerce Product Short Descriptions (And How to Fix It)
Content
Many WooCommerce store owners rely on the product short description field for their primary content. A common point of confusion arises when they notice that the 'SEOPress – On-site SEO' plugin does not analyze this content for its SEO recommendations. If you've found yourself wondering why your keyword density and content length scores seem off, this guide explains the reason and provides a workaround.
The Problem: Content Analysis is Limited to Specific Areas
By default, the content analysis feature in 'SEOPress – On-site SEO' is designed to analyze content from the main WordPress editor. This includes the standard content areas for posts, pages, and some custom post types. However, this analysis does not automatically extend to all custom fields or specific areas created by other plugins, such as the WooCommerce product short description field.
As confirmed in user reports, the 'SEOPress – On-site SEO' team has acknowledged this is a current limitation of the plugin. The content analysis metabox is also not available for taxonomy terms, such as product categories, by default.
Solution: Use a Custom Hook to Extend Content Analysis
Fortunately, the plugin provides a filter hook that allows developers to modify the content that gets analyzed. You can use this hook to instruct SEOPress to also include the content from your WooCommerce short description field (or any Advanced Custom Field) in its analysis.
Step-by-Step Guide:
- Access your WordPress site's file system, typically through your hosting provider's file manager or via FTP.
- Navigate to your theme's folder (e.g.,
/wp-content/themes/your-theme/). - Edit the
functions.phpfile. It is highly recommended to create a child theme before making any changes to avoid losing modifications during theme updates. - Copy and paste the following code snippet at the bottom of the file:
function sp_content_analysis_woocommerce_short_desc($content, $id) {
// Check if the current post is a WooCommerce product
if ( 'product' === get_post_type( $id ) ) {
// Get the product short description content
$product_short_desc = get_post_meta($id, '_product_short_description', true);
// Append the short description content to the main content for analysis
$content = $content . ' ' . $product_short_desc;
}
return $content;
}
add_filter('seopress_content_analysis_content', 'sp_content_analysis_woocommerce_short_desc', 10, 2);
Important Note: The code above uses _product_short_description as the meta key, which is the internal key WooCommerce uses for the short description field. This key should be correct for most setups.
After saving the file, edit a product and you should see that the content analysis now considers text from both the main product description and the short description field.
Troubleshooting
- Code not working? Double-check for typos in the code and ensure you've added it to your active (child) theme's
functions.phpfile. - Using a different custom field? If you want to include a different field, such as one from Advanced Custom Fields (ACF), replace the meta key
_product_short_descriptionwith the name of your custom field. For ACF, this is the field name you set when creating the field. - Check for plugin conflicts. If the solution still doesn't work, temporarily disable other plugins to see if there is a conflict preventing the hook from functioning correctly.
This custom code solution provides a way to enhance SEOPress's analysis until a more native integration might be developed. For official updates on this feature, users can monitor the changelog released by the 'SEOPress – On-site SEO' team.
Related Support Threads Support
-
Google SEOhttps://wordpress.org/support/topic/google-seo-3/
-
How to analyze Woocommerce product short description contenthttps://wordpress.org/support/topic/how-to-analyze-woocommerce-product-short-description-content/
-
Number of characters in dynamic datahttps://wordpress.org/support/topic/number-of-characters-in-dynamic-data/
-
How I can remove the slug /product/ with SEOPresshttps://wordpress.org/support/topic/how-i-can-remove-the-slug-product-with-seopress/
-
Didn’t find “content analysis”https://wordpress.org/support/topic/didnt-find-content-analysis/
-
add content analysis box to product categoryhttps://wordpress.org/support/topic/add-content-analysis-box-to-product-category/
-
Support with advanced custom fieldshttps://wordpress.org/support/topic/support-with-advanced-custom-fields/
-
seopress_content_analysis_content hook is not useablehttps://wordpress.org/support/topic/seopress_content_analysis_content-hook-is-not-useable/
-
Content Analytics in Pageshttps://wordpress.org/support/topic/content-analytics-in-pages/
-
Woocomercere add to cart link nofollowhttps://wordpress.org/support/topic/woocomercere-add-to-cart-link-nofollow/