[wp-trac] [WordPress Trac] #57926: WordPress WP_User_query generate SQL Problem
WordPress Trac
noreply at wordpress.org
Sun Mar 19 12:24:02 UTC 2023
#57926: WordPress WP_User_query generate SQL Problem
-----------------------------+------------------------------
Reporter: hasanyuksektepe | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.1.1
Severity: normal | Resolution:
Keywords: | Focuses:
-----------------------------+------------------------------
Comment (by craigfrancis):
Hi Hasan,
Maybe you only have 1 record that matches, and it's being excluded by:
{{{#!php
<?php
'paged' => ($paged + 1),
'offset' => ($paged + 1),
}}}
Where your SQL contains `LIMIT 1, 20`.
Normally the `offset` starts at 0; and when it comes to this config, you
would either use 'paged' or 'offset' (not both).
---
If that's not it, I've taken your output SQL, replaced the placeholder
escape string, and re-formatted, so you can check if the query works:
{{{#!sql
SELECT
SQL_CALC_FOUND_ROWS wp_users.*
FROM
wp_users
INNER JOIN
wp_usermeta ON ( wp_users.ID = wp_usermeta.user_id )
WHERE
1=1 AND
(
(
(
wp_usermeta.meta_key = 'wp_capabilities' AND
wp_usermeta.meta_value LIKE '%\"customer\"%'
)
)
) AND (
user_login LIKE '%zua.apex%' OR
user_url LIKE '%zua.apex%' OR
user_email LIKE '%zua.apex%' OR
user_nicename LIKE '%zua.apex%' OR
display_name LIKE '%zua.apex%' OR
user_url LIKE '%zua.apex%' OR
display_name LIKE '%zua.apex%'
)
ORDER BY
user_login DESC
LIMIT
1, 20
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57926#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list