As far as i know there is no arguments array key name 'post_category'
in WP_Query . Insted of 'post_category'
use either 'category__in' => array( 2, 6 )
or category_name' => 'staff'
.
And also for the id case use echo get_the_ID()
… to print the post id
Related Posts:
- get_users(…) only returns one user
- Open post-content in archive page in a Modal box with bootstrap
- Making (and edit existing) posts with ID included
- php return username of currently viewed author profile
- How to block specific user id in custom login form?
- Get current user id in function php
- Trying to get post ID outside loop on blog page
- Post from front end form to post_meta
- main menu page redirects to user ID
- Getting a specific post values to another div or modal
- Trying to add attribute to my posts’ featured image
- Displaying the last post on static homepage
- Can’t get wp_insert_post to work
- Why not yield/iterable in posts interface?
- Best practice for migration friendly images in posts/pages?
- How to show part of the_content?
- User’s total comment count excluding comments on their own posts
- current post with current author
- User management system similar to wordpress one?
- Show all posts by author
- Unreadable pagination
- 200 Rewrite blog post links
- How to set a min number of words for a blog post
- Loop through categories and display posts title under each dropdown
- Get post id in a function when edit/add a post
- Custom user login page by creating a plugin
- how do I get a specific post from a post with a subcategory in WP
- Automatically create child pages and grandchild pages when saving a (parent) page
- Programmatic Login from 3rd Party site
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Second transition_post_status hook fired instead of the first
- Add New User, extra fields which are required?
- How to store post ID’s in cookie or session to display the same posts later
- user_profile_update_errors hook not executing
- Which hook/action will help me solve my problem?
- Modify user profile data through scripting?
- How can I add extra word in permalink when someone click download button?
- Get users that likes the post
- Post + form + action + results on the same page
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- add_cap not working
- remove post that has no content
- Do not execute If User is login as Administrator or any Specific Role
- multiple taxonomy select display only one in front end
- Loading index.php contents which located outside blog folder for post single page
- get post content of particular post by url
- Post repeating with infinite scroll
- wordpress archive a user
- Custom posts in different columns style
- Get children post mime type using parent post_ID wp_post
- How to show only subcategories in parent category not parent category?
- Best practice for show data to one specific user?
- 404 error when I acess the second page of post-type
- Call to undefined function get_userdata() in plugin
- Which PHP page is the Default Posts Page
- get_users meta_query: REGEXP not working for matching new lines
- Change CSS based on is_user_logged_in
- retrieve post data and insert it in seperate static html page without WordPress
- How to show a users bio on a page
- “operation successful” message
- WP Insert Post and then go to post
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- Returning data instead of echoing/printing
- Display related posts without a plugin
- Counting Search results, and displaying the offset per page
- Count posts on multisite with blog id
- Function works everywhere, how to keep it to execute when creating a new post
- Copy taxonomy terms from one post to another programmatically
- Parsing Menu Items and Blog Posts
- Pagination on Custom Post
- $wpdb returns duplicate posts
- How to avoid duplicates when creating recent network posts
- php if username is role
- How to show an entire post content and not also the excerpt?
- Get latest post from all categories except one
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Update post title from external file?
- Parse error: syntax error, unexpected end of file
- Help getting previously visited pages ID
- Creating a blog on my companies new website using WordPress but I have sidebar issues
- How do you create two separate Register pages?
- Automatically add images to a menu
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- Load Posts on Click via Ajax into a DIV
- How to catch wordpress post ID when it’s published
- set post limit at load more ajax wordpress
- get_the_ID() in the footer returns wrong value
- Use post ID in functions.php file adminside
- WordPress query undefined offset in loop
- Find Site ID From WP_Post
- Is it possible to create new user from external form using REST API?
- WP_Query: getting posts where custom field exists
- Foreach loop inside an array_merge
- Array to string conversion on array_map
- Store metakey value as an array
- Increment paged on WP_Query
- Show current user posts only
- Only show first image in foreach loop
- echo esc_url( get_permalink($post->ID) + complete the ID’s url
- Change page password every day (predictable password ;) )