Chris Mucheke
Forum Replies Created
-
Forum: Plugins
In reply to: [Advanced Custom Fields (ACF®)] Custom fields in default search?Hi @jacejace
This is not possible with the ACF plugin as it is out of the box.
Please note that by default, WordPress does not include custom field data in search results. In order to add this data, you will need to modify the WordPress search query so that it runs in the
wp_postmetatable as well.One way to accomplish this is to use the “update_post_meta” hook to save the ACF field data as post meta, which you can then index. Another option is to use the “posts_join” and “posts_where” filters to modify the SQL query which you can then use to search the content, which can include the ACF fields.
Forum: Plugins
In reply to: [Advanced Custom Fields (ACF®)] Sorting field groups in the admin dashboard?Hey @juliana9
There’s no drag-and-drop reorder UI in ACF itself. In the classic editor you could reorder metaboxes by dragging them on screen, but that doesn’t carry over reliably in the block editor, so
menu_orderis the way to go.You can set it directly inside each field group’s settings (Edit Field Group → scroll down to Group Settings → Menu Order). Lower numbers appear first. If two groups have the same value, they’ll fall back to alphabetical.
If you’re managing field groups in PHP or via ACF’s local JSON, you can set it there too:
// In a PHP-registered field group: acf_add_local_field_group( [ 'key' => 'group_123', 'title' => 'My Field Group', 'menu_order' => 10, // ...rest of your config ] );Or in your
group_xyz.jsonfile:{
"key": "group_123",
"title": "My Field Group",
"menu_order": 10
}Hope that helps!
Forum: Plugins
In reply to: [Advanced Custom Fields (ACF®)] Compare Custom postsHey @aftab1003
This is totally doable. A dedicated Comparison CPT with ACF relationship fields is the cleanest way to handle this.
You can set it up like this; create a new CPT (e.g.,
mobile-comparison) and attach an ACF field group to it with two Relationship or Post Object fields, one for each mobile being compared (e.g.,phone_aandphone_b). Point both fields to your existingmobilespecsCPT as the source. When the admin creates a new Comparison post, they simply pick the two phones to compare. No front-end selector needed. All comparison content lives on the Comparison post itself, as you intend.To display it, use
get_field()to fetch each selected post object, then pull the ACF fields from those posts using the post ID.Could you try that and let me know if it gets resolved?