wp_insert_post deleting previous post custom meta

SOLVED… for now I think this code was my problem: // use reset postdata to restore orginal query wp_reset_postdata(); if ( $current_slug == $approve_slug && $success === 1 && isset ($success) ) { $next_pay_stub_id = create_next_pay_stub( $term->term_id ); } } //this is the closing bracket of my foreach statement which I changed to if ( … Read more

Sort by an ACF field in a tax_query

You have placed orderby in a wrong array. Please check modified code. $loop = new WP_Query( array( ‘post_type’ => ‘partenaires’, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘posts_per_page’ => -1, ‘paged’ => $paged, ‘meta_key’=> ‘partners_order’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘type_partenaires’, ‘field’ => ‘ID’, ‘terms’ => $term->term_id ), ), … Read more

Make custom post types using ACF

I don’t believe that custom post types are a part of ACF. I use custom post type generators to add post types. This is the one that I use. You would just need to paste the resulting code at the bottom of your theme’s functions.php file.