Get current user last post date

Is that the only code you’ve used? As the name suggests that function returns the entire post, not just the date. You still need to actually get the date from that post. $user_id = 2; $post = get_most_recent_post_of_user( $user_id ); if ( $post ) { echo get_the_date( ‘Y-m-d’, $post ); } See the PHP documentation … Read more

Display post count for a specific month

here is correct answer if someone need $aprel = get_queried_object(); /////////////////////////////////////////////////// $aprelpost = array( ‘post_type’ => ‘sikayet’, ‘post_status’=>’publish’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘sectors’, ‘field’ => ‘slug’, ‘terms’ => $aprel->slug, ), ), ‘date_query’ => array( ‘year’ => 2021, ‘month’ => 3 ) ); $aprelpost_query = new WP_Query ( $aprelpost ); $ap … Read more

If X Amount of Time Has Passed Since Post Was Published, Do Something

What the current code does human_time_diff( get_the_time( ‘U’ ), current_time( ‘timestamp’ ) ) produces the time between when the post is published and the current time as a human readable string such as ‘6 days’. Meanwhile, strtotime( ‘7 days’ ) retrieves a integer timestamp representing 7 days after this moment, e.g. 1625673951. With that in … Read more