Sending simple variable on single page to WP JSON
Sending simple variable on single page to WP JSON
Sending simple variable on single page to WP JSON
How do I get specific readable results from this query and array results
Do you actually insert the comments right after you created the CPT post? I.e. Both the snippets in the question are in the same scope, e.g. wp_insert_post( $post_array ); for($j = 1; $j <= $total; $j++){ … wp_insert_comment($comment_array); … }. If yes, then you can store the post ID returned by wp_insert_post() to a variable … Read more
Save / Update meta data as multidimensional array
Convert a column of a table containing an Array as response in HTML
Override a Post’s URL with Advanced Custom Fields Function
Problem with inserting multiple images in gallery of each WooCommerce product programmatically
I think I’ve cracked it. So now the latest post for each tag type is now displayed. A bit beyond my coding level but its working. <?php $args = array( ‘type’ => ‘post’, ‘orderby’ => ‘post_date’); $tags = get_tags($args); foreach($tags as $tag) { $the_query = new WP_Query( ‘tag=’.$tag->slug ); if ( $the_query->have_posts() ) { $the_query->the_post(); … Read more
You would do it the same way as any other PHP application, this isn’t a WordPress problem. To remove an item from an array in PHP, use unset( thing to remove ). E.g. $test = [ ‘banana’, ‘cucumber’, ‘apple’ ]; unset( $test[1] ); // cucumber is no longer in the test array, and the array … Read more
I solved my problem with: https://stackoverflow.com/questions/61622017/get-woocommerce-product-categories-that-contain-a-specific-product-brand/61624358#61624358 turns out wp_query wasn’t the right choice for my requirements.