It looks to me like you are using strings when they should be int.
'posts_per_page' => '20', // '20' is a string
'cat' => '508' // '508' is a string
Should be
'posts_per_page' => 20, // 20 is int
'cat' => 508 // 508 is int
I think this is probably the main issue.
Also we would need to see if your custom post type uses the default categories. If not ‘cat’ will not work and you may need to use ‘tax_query’ in place of ‘cat’.
Hope this helps good luck.
Related Posts:
- Setting Custom Sort Order of Posts within a Category
- How to change the layout and styling of posts according to their category in WordPress?
- Add default content to post (for specific category)
- Show One Category on Post
- Add custom field to category of custom post type
- Do I use custom post type or something else?
- Custom Theme Want To Remove One Category From All Displays
- Edit custom post type admin menu link
- Deleted category by mistake, all posts now have categorized category. Can i revert that?
- How can i limit the number of posts created per category?
- WordPress custom Query for Posts in Category display posts multiple times
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Set Default Category to Username
- if in category but only with post meta
- How to call posts under a specific category on static front page?
- Static pages not working
- How to display only one category in a custom post type?
- Can I style single post that are in multiple catergories?
- Custom post styling per category?
- Show custom post category for single post
- Add Categories To Custom Post
- Static text above category page
- Show a Category Specific Info Box
- Add default content to post (for specific category)
- Display ONLY Latest Post From Several Categories
- Taxonomy Category category.php not working
- Post’s arent displaying
- Only show posts belonging to multiple cateogries at same time
- I have a website issue I am trying to resolve
- How to show related posts by category
- Find out who deleted a page or post?
- Replace image attributes for lazyload plugin (data-src)
- Any way to create a revision of a post ONLY with a new button in the Meta Box?
- How to disable Uncategorized category URL?
- Add role that restricts user to post in specific category
- How to display comments and comment form on custom post type?
- Archived Posts in Wrong Category
- Custom post type single (permalink) throws a 404 error
- Display all posts under child sub category in sidebar on post page?
- how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?
- How do I get the slug of a custom taxonomy category of a post?
- Featured Posts for Category Pages
- Authors in menu, template list post by author
- Get post id in wordpress action?
- Count to how many categories a post belongs to
- How to display WordPress archive into three columns [closed]
- How to include a post type in the admin/backend?
- Get mixed category random posts
- Using wp_list_categories like the the_category (showing just current categories of a post)
- Using custom post template
- Adding custom fields to bbpress reply form
- How to allow users to post only in certain category and hide elements from edit page?
- Need help with category listing!
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- How to display two blog categories as separate sections on one page?
- Thumbnail & Category link aside post
- WordPress custom post type with folder structure in slug
- get posts from Custom Post Type & Category
- How to enable custom Shortcodes in Post Category Description? [duplicate]
- Sort by last word in title
- Show custom post with custom categories with specific slug
- Add post tags to previously created custom post type
- Getting posts from some categories plus some individual posts
- Change layout of post depending on category
- Different post views for different category views
- Possible?! A contextually titled back link
- Allow / show post comments in category pages
- How to select a category automatically based on a word in WordPress post title?
- Display default matabox of posts(add category) wordpress
- How display related post only in Default category on single
- How to get tags when using publish_post
- How to add class to specific navbar item when post parent category is in specific category
- How do you change the permalink for posts for a single category?
- Pagination Not Working With Custom Post Type Category
- Posts are not displaying on their category and tag page
- how to create a category with wp_insert_post and post_category
- Exclude posts in a category on one page but show those posts on a different page
- How to add a block to a category page?
- Excluding category from post navigation in WordPress?
- Post Category link is same with Page link
- Get a list of categories that are related to posts
- How can change header text in post careate/edit form
- Difference between modified post and new post
- Precedence of page permalinks over woocommerce product category links?
- Creating widget – ask for selecting a post in the admin panel
- wp query custom orderby not custom field
- Customizing individual images on posts
- Add category selection to function request
- Query post category & remove any post id
- Show Post number of specific Category
- How to modify specific parts of a post content in WordPress
- Include post on external custom site
- Run Jquery Script after delete post in front end
- how to show posts on different pages if number of post per page is one
- Is possible to create a custom link that creates a post that’s already categorized?
- Category pages vs single post pages
- How can I allow users (subscribers) to download selected posts into a single PDF? (RESOLVED)
- How to display subcategory articles in the category view?
- How do we display a certain category type on a page while hiding all others?
- Display posts from a specific category on frontpage.php template?