AdvancedCustomFields / acf

Advanced Custom Fields
http://advancedcustomfields.com/
823 stars 168 forks source link

post-object field select2 'search' in wp-admin not returning results when on subsite of multisite #888

Closed jonathanwarde closed 4 months ago

jonathanwarde commented 7 months ago

Describe the bug When using a select2 search input on a post_object field type on a multisite network, it always returns no results. This bug does not occur on a single site installation or on the primary site of a multisite - only subsites. When var_dumping the SQL that ACF send to WP_Query after an admin-ajax request, I can see that the clauses for the tables are muddled with primary site tables ('wp_posts') and the current subsite tables (ie. 'wp_2_posts').

To Reproduce Steps to reproduce the behavior:

  1. Create a post object field on the subsite of a multisite (for posts and pages)
  2. Click on the dropdown in the admin page - results will load 20 at a time, which is correct
  3. Type the name of a valid post or page in the search input on the field - it will display 'no results found'

Expected behavior i would expect to see results from the ajax search when on the subsite of a multisite

Version Information:

lgladdy commented 4 months ago

Hey Jonathan,

I can't reproduce this. Could you have some code or another plugin that is doing something to the query?

Feel free to reopen if you can give us a reproducible example without other plugins and with twentytwentyfour.