As of May 31, 2023, we have updated our Code of Conduct.
4 votes

True/False ACF field returning null by default even if default value is true

You will need to update every existing post otherwise, you will get NULL every time even if you set the default value to TRUE. You can bulk edit/update altogether.
Harit Panchal's user avatar
3 votes

True/False ACF field returning null by default even if default value is true

As Harit Panchal mentioned. Creating a new ACF field, true/false in this case, and setting a default value for it, wont automatically set this value for every existing post, page, term, etc, it's ...
Buttered_Toast's user avatar
2 votes
Accepted

How to detect if an ACF custom-field is really in use?

Most sensible here is probably just a custom query global $wpdb; $sql_find_meta = "SELECT post_id FROM database_name_here.wp_postmeta WHERE meta_key = 'my_special_value' AND meta_value > '';&...
Bysander's user avatar
  • 1,207
2 votes

Display posts from specific slug of the custom taxonomy in Wordpress

I would recommend becoming intimately familiar with the WP_Query parameters: https://developer.wordpress.org/reference/classes/wp_query/ In your particular case; dealing with taxonomies: https://...
josh401's user avatar
  • 41
1 vote

Display custom post type attached media file sizes

From your array, you should get the Media ID of the videos. If you have the media ID, it will be as listed below: // Let's say you have the media ID $meta = filesize( get_attached_file( $attachment_id ...
Cristian Stan's user avatar
1 vote
Accepted

Best performance for use Custom Field in WP

Neither will be faster because the root of the performance problem is the WP table design, not the plugin. The post meta table is optimised for finding values when you already know the post ID/keys, ...
Tom J Nowell's user avatar
  • 56.4k
1 vote

Custom Sort Order for Custom Post Type Taxonomy

Use usort with a custom callback, like this: function compare_term_order_numbers( \WP_Term $a, \WP_Term $b ) : int { $order_number_a = get_field( 'order_number', $a ); $order_number_b = ...
Tom J Nowell's user avatar
  • 56.4k
1 vote
Accepted

Post object GUID adding http:/

You should not be using the GUID as a link. If you want to get the URL for a WordPress post object you should use get_the_permalink(): href="' . esc_url( get_the_permalink( $package_link ) ) . '&...
Jacob Peattie's user avatar
1 vote

True/False ACF field returning null by default even if default value is true

The answers so far explain how to fix this but not why it happens. The issue exists because when you created the existing items the default was null. This means that the existing items have a value in ...
MD-Tech's user avatar
  • 111
1 vote
Accepted

How to get all specific fields from one ACF Group?

U can use get_fields() which return all fields from current page. Additionally you can filter array checking which key matches. Example: $questions = get_fields(); $questions_array = array_filter($...
Patryk Gielo's user avatar
1 vote

How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post?

You should probably check out pre_post_update. Use pre_post_update to check for a post update within your custom post type Container of Things. Check for your conditions. Then, get the connected ...
DeltaG's user avatar
  • 869
1 vote
Accepted

Upload non-featured image to image field

You should read up on the wp_insert_attachment function. You can check it out here https://developer.wordpress.org/reference/functions/wp_insert_attachment/. It does not automatically set the image as ...
DeltaG's user avatar
  • 869
1 vote

Function wp_enqueue_style was called incorrectly

Wordpress uses a system of so-called "hooks", which are functions that are run at specific points within the process of building the webpage for the browser. The system runs like this: A ...
HU is Sebastian's user avatar
1 vote

get the title of a relationship field

you don't need a function... $my_query = get_posts(array( 'post_type' => 'post_type_name', 'meta_query' => array( array( 'key' => 'relationship_field_name', ...
Julien's user avatar
  • 11

Only top scored, non community-wiki answers of a minimum length are eligible