How to let a user create a post by submitting a POST form?

The echo part should be at the end of your code. Keep that in mind, any echo or print should be at the end of your piece of code. <?php if( $_POST[‘title_given’] ) { // Create post object $my_post = array( ‘post_title’ => wp_strip_all_tags( $_POST[‘title_given’] ), ‘post_content’ => ‘Did it work??’, ‘post_status’ => ‘publish’, ‘post_author’ … Read more

WordPress Query – Display 5 posts (same post type), each from a given tag

Managed to get what I wanted like so: // first query $first_ids = get_posts( array( ‘post_type’ => POST_TYPE_KIB_HIREK, ‘posts_per_page’ => 1, ‘post_status’ => ‘publish’, ‘orderby’ => ‘date’, // popular – ha a legolvasott ‘tag_id’ => 102, ‘order’ => ‘DESC’, ‘fields’ => ‘ids’, ‘post_status’ => ‘publish’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’ )); // second query … Read more