Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Matt

Bug: ACF Sorting a true/false Fields with Search is hiding resultes

Hello,
While working on a client site we came across a bug.

It appears when using the Search field on the posts page in the backend, “/wp-admin/edit.php”, and then try and sort and ACF Column that has an ACF true/false field it only returns results that have the field set as true regardless if the sort is ASC or DESC. It also happen when you sort and then search.

We have the most recent versions of Advanced Custom Fields PRO Version 5.5.9, Admin Columns Pro Version 3.8.9 and Admin Columns – Advanced Custom Fields add-on Version 1.3.5.2 at the time of this post.

We have the setting “Show all results when sorting.” checked and it works properly in other cases.

We have tested with with the post, page and custom post types with the same result.

We were able to get it to work properly if you use just a “Custom Field” column rather than and ACF column with the ACF true/false, so it appear the issue is in the ACF addon.

Please let us know if you have any questions or need any more information
Thanks

We where able to get it to

similar to this one Bug: ACF Sorting/Filtering for true/false Fields.

4 years, 6 months ago
Matt

So we reviewed the plugin and found that it is conflicting with WordPress core’s get_cast_for_type and get_sql_for_clause where it would pass the meta type and cast is as a SIGNED number.

Which would then add AND CAST(mt2.meta_value AS SIGNED) != '' ) ) to the query.

This then causing anything with a ACF true/false field set to false or 0 to fail that AND condition and would filter them from the query.

We where able to fix the issue by updating the admin-columns-pro/classes/sortable/classes/model.php file on line 337 updated to 'true_false' => SORT_REGULA, rather than using SORT_NUMERIC.

Please let us know if this is something that will be fixed in another release of the plugin, Or if there is an alternative method we should take? Also if you have any other questions or need more info.

Thanks

4 years, 6 months ago
Stefan
Developer

Hi Matt,

Thanks you very much for your feedback and for the research you’ve done so far.
I will check for this in our upcoming 4.0 release. It is a complete refactor of Admin Columns Pro and the way we sort, filter and use inline edit has changed so maybe this issue is already fixed. I’ve created a ticket for this on Github so we can track it.

https://github.com/codepress/admin-columns-issues/issues/674

Thanks again for the time already investigating this, this is really appreciated!

4 years, 6 months ago
Stefan
Developer

Hi Matt,

I tried to reproduce the issue in our latest build and it seems that this issue if fixed in the upcoming 4.0 release. If you like I can send you the beta / nightly so you can test it on your environment.

4 years, 6 months ago
Matt

Hey Stefen,
We downloaded the 4.0 beta and tested it on our staging and it appears to be fixed as you said. Thanks for taking a look and sending the reply.

4 years, 6 months ago
Stefan
Developer

Hi Matt,

Thanks for testing this. I guess that you’ve downloaded the beta version from the website. This release is already some months old and a lot has changed since that release. But I believe this issue is still fixed in our current development version.

4 years, 6 months ago

You must be logged in to reply to this topic.