How to retrieve category NAME instead of ID in a function with a taxonomy custom field?

You need to get the term object first. //Your meta field $post_custom_title = get_post_meta($post_id,’car_name’,true); //Get the term object by id. change taxonomy_slug to the taxonomy you intend to use $term = get_term_by( ‘id’, $post_custom_title, ‘taxonomy_slug’ ); //Retrive the term name and use it as post title $term_name = $term->name; //call the wp_update_post function setting $term_name … Read more

WP_Query ordering numbers as letters

To evaluate a meta value as a number, use meta_value_num. Try: $args = array( “fields” => “ids”, “meta_key” => “jogador_oficial”, “meta_value” => true, “meta_query” => array( “relation” => “AND”, “query_one” => array( “key” => “quantidade_corretas” “orderby” => “meta_value_num”, “order” => “DESC” ), “query_two” => array( “key” => “tempo_total” “orderby” => “meta_value_num”, “order” => “ASC” ), … Read more

ACF: Only get first row of a Repeater Field

ACF has a function called get_row_index() that you can utilize. Here is how you can possibly use it in your case <?php $active=”active”; while ( have_rows(‘images’) ) : the_row(); $image = get_sub_field(‘image’); if(get_row_index() == ‘1’ ): ?> <img src=”<?php echo get_template_directory_uri(); ?>/files/images/<? php the_sub_field(‘image’); ?>” class=”img-fluid is-slider-item” /> break; <?php $active=””; endwhile; ?> <?php endif; … Read more

Faking the “onSave” event

Have you seen wpshell? It’s a command line tool for wordpress. Basically, it’s a WordPress environment that lets you run arbitrary php – so you could set up a WP_Query that pulls all posts, loop through them, and fire that command on each one. Sort of what I had in mind, untested. Using wp_update_post() as … Read more