Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress Yoast Dashboard Widget is not showing accurate statistics. #7130

Open
starnesd opened this issue May 19, 2017 · 1 comment
Open

Comments

@starnesd
Copy link

starnesd commented May 19, 2017

What did you expect to happen?

For instance, following SQL executes and returns 31 for found rows. (SQL captured using query monitor and deleting the _transient data)
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
INNER JOIN wp_postmeta
ON ( wp_posts.ID = wp_postmeta.post_id )
WHERE 1=1
AND ( ( wp_postmeta.meta_key = '_yoast_wpseo_linkdex'
AND CAST(wp_postmeta.meta_value AS SIGNED) BETWEEN '71'
AND '100' ) )
AND wp_posts.post_type = 'post'
AND ((wp_posts.post_status = 'publish'))
GROUP BY wp_posts.ID
ORDER BY wp_posts.post_date DESC
limit 0,30
;select found_rows();

removing the 'limit 0,30' provides 51 for found rows.

Clicking on widget shows 21 OK and 21 good.

What happened instead?

image

How can we reproduce this behavior?

Not sure. As stats come from my post data.

Can you provide a link to a page which shows this issue?
https://iwtdev.interweave.com/wp-admin/index.php however you would need login which i could provide developer.

Technical info

  • WordPress version: 4.7.4
  • Yoast SEO version: 4.7.1
@moorscode
Copy link
Contributor

Hi @starnesd

Thank you for finding and reporting this issue.

Currently the number of posts per page in the General settings are being fetched and cache-primed for these queries. We though only need the number of items that apply, not the data of those posts.

We need to do a COUNT(ID) instead of using found_posts.

This is happening here: https://github.com/Yoast/wordpress-seo/blob/trunk/inc/class-wpseo-statistics.php#L56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants