Sorting posts by season

Probably the most “WordPress-y” approach to such a problem is to store the date of your ‘event’ custom post-type in the post’s metadata. Enabling users to set meta-data on a post is usually accomplished by using the ‘register_meta_box_cb’ argument to the register_post_type() function to add an extra “meta box” interface to the pages for creating … Read more

random p tag in advanced custom fields?

The problem is with WordPress’s wpautop() filter. Here’s what ACF says to do: https://support.advancedcustomfields.com/forums/topic/removing-paragraph-tags-from-wysiwyg-fields/ This is a normal WP behaviour – to turn all new lines into paragraph tags. To remove this, you can try loading the value without any formatting. You can do this by providing a ‘false’ for the format parameter in the … Read more

WP Rest endpoint with custom post type and ACF Fields

Advanced custom fields uses get_field() function to retrieve the fields. So, all you have to do is to retrieve them by using: $field = get_field(‘field_name’, $post->ID, ‘format_value’); for each of your fields in the loop. You can read this page for more information. Questions about plugins are off-topic here, That’s why your question haven’t receive … Read more

Inconsistent behavior from number_format

Seems like the function you using is the the_field function from of ACF which is a function that outputs a string so the formatting number_formatt dosent effect the output. This code: <?php echo number_format(the_field(‘price’)); ?> The echo does not really print anything, the function the_fields prints the output, that’s the reason the number_format function doesn’t … Read more

Using pre_get_posts for meta value of LIKE comparison on ACF repeater sub field

You need to add Wildcards to your meta_value. Change $query->set(‘meta_query’, array( array( ‘meta_key’ => ‘test_repeater_%_test_sub_field’, ‘meta_value’ => $search, ‘compare’ => ‘LIKE’, ), )); To $query->set(‘meta_query’, array( array( ‘meta_key’ => ‘test_repeater_%_test_sub_field’, ‘meta_value’ => ‘%’.$search.’%’, ‘compare’ => ‘LIKE’, ), ));

Post Object Filter by Custom Field, not title (ACF)

There’s another filter for the post_object: acf/fields/post_object/result, that lets you customise the result (text) displayed for each option in the post object field. Try something like this: function my_post_object_result( $title, $post, $field, $post_id ) { /* Get whatever value you want here e.g. */ $short_title= get_field(‘short_title’, $post->ID); /* do any other processing you might want … Read more

WP Custom Fields Metabox Disappears – ACF plugin issue [closed]

ACF 5.6+ intentionally removes the custom fields metabox to improve performance when loading posts. To display the metabox, add this to functions.php in your theme: add_filter( ‘acf/settings/remove_wp_meta_box’, ‘__return_false’ ); In addition to the above code, make sure that the custom fields metabox is enabled in Screen Options at the top of a post, and that … Read more