display wordpress user who published a pending post of another user

get_the_modified_author(); isn’t going to tell you who published the post, just who last edited it. You will need to capture you publisher yourself. function post_published_notification( $ID, $post ) { $publisher = wp_get_current_user(); update_post_meta($ID,’my_publisher’,$publisher); } add_action( ‘publish_post’, ‘post_published_notification’, 10, 2 ); Then use get_post_meta($post_id,’my_publisher’) to retrieve the data. Of course there are a numerous ways to … Read more

Sort an array with an ACF meta key

In you $args you need to make sure to order your categories like so: $args = array( ‘taxonomy’ => ‘category’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘hide_empty’ => 0 ); $c = get_categories($args); Did you make a custom taxonomy and use that within ACF?

ACF pro: Group teaser by datepicker year and display custom sub fields [closed]

The reason you can’t use ACF or functions such as the_title() is because they can only be accessed from inside The Loop (see here https://codex.wordpress.org/The_Loop). Its unnecessary to have multiple loops so I’ve merged them into one which will display any post data you need. Within this loop it checks whether the current post’s year … Read more

How to display remaining post ( in post__in ) if posts are less then post per page?

I think the simplest, but not necessarily the most performant, would be using two WP_Query loops, one using $query->set( ‘post__in’, $product_ids_on_sale ); and other using $query->set( ‘post__not__in’, $product_ids_on_sale ); because these are mutually exclusive. One loop would be used for the main query and other for second loop as show in this example in the … Read more

Sort my event calendar by date

I’ve used Jared’s approach several times successfully, although I agree that Stephen Harris’ answer should also now work (but it’s a more recent addition to WP_Query which wasn’t available at the time I was building an events listing). Depending on the date format you are suing to store the date, you might also need to … Read more