If you are using All in One SEO or All in One SEO Pro together with FacetWP, be aware of the following issues and incompatibilities:

Fix no results after filtering

All in One SEO logo

In specific situations, AIOSEO (Pro) will cause a JSON error in the AJAX refresh data that is returned to FacetWP after filtering. This will cause FacetWP to be unable to process the response, resulting in a “no results” message, or simply no posts showing up.

Fortunately there is an easy fix.

Triggers

The following factors all need to be present to trigger this error:

  1. All in One SEO (Pro) is installed.
  2. As listing template you are using a WP archive page, a custom WP_Query, or a page builder query. The issue does not happen when you are using a Listing Builder listing template.
  3. Your active theme does not have support for the ‘title-tag’ feature. This causes AIOSEO to use PHP output buffering to customize the theme’s <title> tag, which in turn is the cause of these issues.

How to test for ‘title-tag’ theme support

To quickly test if your theme has support for the title-tag feature, you can temporarily add the following to your theme’s functions.php:

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

// Remove after testing add_action( 'after_setup_theme', function() { var_dump( current_theme_supports( 'title-tag' ) ); // outputs bool(false) if 'title-tag' is not supported, or bool(true) if 'title-tag' is supported } );

If you see the output bool(false), your theme does not have this feature, and you can apply the fix below to add support for it.

If it outputs bool(true), your theme does already support this feature, which means that the “no results” issue is not caused by the AIOSEO plugin.

What is the ‘title-tag’ feature?

Before WordPress version 4.1, the only way to dynamically generate <title> tags based on the page/post title was by using the wp_title() function in the <head> section of the theme. To customize its output, theme authors could use the wp_title hook.

In version 4.1, WordPress introduced a new way of generating title tags, by letting WP Core handle their generation and output. Since then, the <title> tag can be customized with a range of new filters, like the document_title_parts hook. The wp_title() function was deprecated (but later reinstated again). The use of wp_title() is now discouraged.

By declaring 'title-tag' support, themes acknowledge that they are not defining titles on their own and WordPress can safely add them without duplication.

The fix: add ‘title-tag’ support

Most modern themes have 'title-tag' support. If your theme does not have it, you can enable it by adding the following code to your theme’s functions.php:

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_action( 'after_setup_theme', function() { add_theme_support( 'title-tag' ); } );

If you do this, you have to remove any uses of wp_title() in the <head> section (generally in your theme’s header.php file), to prevent duplicate title tags.

Alternative fix: disable title rewrites by All in One SEO

If you don’t want to add ‘title-tag’ support to your theme, an alternative fix is to disable <title> rewrites by AIOSEO. You can limit this to your facet page like this:

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( 'aioseo_disable_title_rewrites', function( $disabled ) { if ( is_page('my-facet-page') ) { return true; // disable AOISEO title rewrites } return false; } );

Or you can apply it site-wide:

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( 'aioseo_disable_title_rewrites', function( $disabled ) { return true; // disable AOISEO title rewrites } );

Be careful with this, as it could potentially hurt your SEO.

Fix a “FacetWP was unable to auto-detect the post listing” error

If you see “FacetWP was unable to auto-detect the post listing” after using facets, make sure to disable the “Run Shortcodes” setting, located under All in One SEO > Search Appearance > Advanced. AIOSEO shortcode parsing breaks FacetWP’s query detection.

Disable shortcode parsing by AIOSEO.
Disable shortcode parsing by AIOSEO.

Alternatively, if you have a reason to enable this setting, you can exclude facetwp shortcodes from being parsed by AIOSEO, using the aioseo_conflicting_shortcodes hook. To do so, add the following code to your (child) theme’s functions.php:

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( 'aioseo_conflicting_shortcodes', function( $conflictingShortcodes ) { $conflictingShortcodes = array_merge( $conflictingShortcodes, [ 'FacetWP' => '[facetwp]', ] ); return $conflictingShortcodes; } );

Fix AIOSEO URL redirects in older AIOSEO versions

In some older versions of AIOSEO there is a setting called “Remove Query Args”, located under Crawl Cleanup, found in the section: Search Appearance > Advanced > Crawl Cleanup.

If you have that setting, make sure to disable it:

Disable AIOSEO's Crawl Cleanup > Remove Query Args setting under Search Appearance > Advanced.
Disable AIOSEO’s Crawl Cleanup > Remove Query Args setting under Search Appearance > Advanced.

If this setting is enabled, query arguments will be automatically removed from the URL, and the page will get a 301 redirect to the URL without any facet selections. This breaks facet filtering.

Note that query arguments are only removed by this setting when you are not logged in.

In newer AIOSEO versions, the above-mentioned setting is replaced by a “Query Arg Monitoring” section. If you use this, make sure not to block any query arguments that are used on pages with facets.

See also

Last updated: August 12, 2024