Testimonials are repeating when they should be unique
If you're running WordPress SEO and attempting to display multiple blocks of unique testimonials widget, you might get the dreaded "No testimonials founds" or repeating testimonials despite having the correct limit set.
The specific cause is add_action( 'wpseo_opengraph', array( $this, 'description'), 11 );
. In debugging more deeply, it seems that the description
method calls get_the_excerpt
when there's no given "WordPress SEO Meta Description". The problem with this is that for some reason, it resets the global wp_query
despite WordPress SEO taking steps to work around such an issue.
Easiest solution:
Add a "WordPress SEO - Meta Description" to the pages with unique testimonials being shown on them.
Harder solution:
Add a PHP function to the theme's function.php
file which removes the wpseo_opengraph
action. Example follows. Be sure to update the 17440, 17700, 12345
of $twp_pages
to the same page ids of the live site with unique testimonials shown on them.
<?php function twp_unique_caching_enabler() { $twp_pages = array( 6039, 1234, 7009 ); if ( is_page( $twp_pages ) ) { global $wpseo_og; remove_action( 'wpseo_opengraph', array( $wpseo_og, 'description'), 11 ); } } add_action( 'plugins_loaded', 'twp_unique_caching_enabler', 99 ); ?>