Custom fields in the billing address section woocommerce

I have run into these issues before myself. I am not entirely sure it’s possible to get adjust the billing address box directly unless you adjust the actual email template for the emails. Specifically, if you have access to the file structure, look in the “/wp-content/plugins/woocommerce/templates/emails” folder of the WooCommerce Plugin. They are made to … Read more

Why the value of the selector doesnt remain visible in the custom field after I edit the post?

There’s nothing in your code that would allow this to happen. In your HTML you need to add a selected attribute to the <option> element representing the current value. WordPress includes a helper function, selected() which can help with this: function camere_meta_box_render( $post ){ $number = get_post_meta( $post->ID, “function_camere”, true ); echo ‘<div><select name=”function_camere”>’; for( … Read more

Sort wp_query of two post types using meta datefield for one and date for the other – possible?

Try this WP_Query arguments: $args = array( ‘post__in’ => $all_ids, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘_event_date’, ‘compare’ => ‘EXISTS’, ), array( ‘key’ => ‘_event_date’, ‘compare’ => ‘NOT EXISTS’, ‘value’ => ‘dummy_value’ // This is just to ensure this condition gets evaluated. ) ), ‘orderby’ => array( ‘meta_value_num’ => ‘DESC’, ‘date’ => … Read more

Can’t expose custom field to REST API

I think the problem here is how you register the rest routes and how you return data for the single project endpoint. When you register the route and the callback like this. function single_project($data) { $post_ID = $data[‘id’]; return get_post($post_ID); } add_action(‘rest_api_init’, function () { register_rest_route( ‘project/v1’, ‘post/(?P<id>\d+)’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘single_project’, … Read more

Can I count every article following extracted meta value?

Use array_count_values() (untested): <?php $posts = get_posts( array( ‘numberposts’ => -1, ‘category_name’ => ‘bird’, ‘order’ => ‘ASC’, ) ); if ( $posts ) { foreach( $posts as $post ) { $species[] = get_post_meta( $post->ID, ‘species1’, true ); $species[] = get_post_meta( $post->ID, ‘species2’, true ); } } $species = array_filter( $species ); $counts = array_count_values( $species … Read more

Custom Field in Page Title

Use the wp_title filter, which passes the current title, separator, and location as arguments. It then appends the custom field value to the title if the conditions are meet. For more details :- Visit Link wp_title function wpse_224340_document_title($title, $sep, $seplocation) { global $post; // make sure the post object is available to us if (is_singular(‘mec-events’)) … Read more

WP_Query not using relation key as expected and not producing any results

From the developer docs: relation (string) – The logical relationship between each inner meta_query array when there is more than one. Possible values are ‘AND’, ‘OR’. Do not use with a single inner meta_query array. (Emphasis mine). It’s a bit hacky, but you could run a separate query against the meta field, then merge the … Read more

How to conditionally display an ACF custom textarea contents only to those users chosen from an ACF User field

I’m quite new to this so I might be the wrong person to answer your question but: get_field(‘allowed_users’) Returns an array of user IDs so you can’t directly use in_array() So if you change the if statement to: if (is_array($allowed_users) && in_array($current_user_id, $allowed_users)) Hopefully it will work.

How to display WordPress Twenty Twenty-Four’s built-in custom field in a post (or page)?

WordPress’s Twenty Twenty-Four theme makes it possible to add custom fields directly in the editor This UI is not coming from TwentyTwentyFour, and was added to WP decades ago: It predates 2024/2023 and was even present when the original Kubrick theme was the default theme, this is because it’s a part of WordPress itself. … Read more