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
- Is there a action hook for the “Empty Trash” button?
- MySQL Query to Retrieve Category from wp_posts
- Where does WordPress store the users customization in the theme
- Category checkbox list tree changes when editing a post
- delete post also attachments
- How do I create a featured post within a custom post type?
- Single.php Active Category Class
- Navigation link to specific user page
- Most efficient way to list all categories and display a post for each of them?
- How to edit wordpress RSS feed to show post title only
- Is it possible to have two different previews of a post (ie. two templates for one post)?
- WordPress menu that shows all posts in a certain category like w3schools
- Filter Posts By Tag
- How to limit displayed posts on wordpress
- Select a random post from a specific category?
- How to filter posts that belong to a specific category only if that is the only category
- Category List (Archive) Page Template By Category
- List posts in a given category
- I want to display custom text widgets for each post in the sidebar?
- Display posts styled exactly like default posts
- post categories
- Move first half of posts to one parent page, second half to the other page
- Responsive images with custom image size
- Take a received feedback item, turn it into a post
- How to allow visitors to filter posts by multiple taxonomies
- Limit the number of posts a category can have – newest post goes in, oldest one drops out, possible? plugin?
- a little direction on custom post type
- How do I show posts from another wordpress installation?
- Create a custom posts page
- How to show a custom taxonomy in the theme?
- How to import nested categories from XML file?
- Migrate posts from category and sub-category via SQL
- Display post number by category
- Deleted a user with administrator rights. Now all the data/content/images are lost. how to recover them back
- register_post_type permalink
- Custom Post Limit for homepage only without plugin?
- How to get post with slug and exclude categories
- Adding a custom post type meta field to rss
- Help with listing current users submitted custom post type in template file
- Deleting old posts
- How To Use Custom Tax of a Post Type
- Categories Listing and Highlighting current category item
- Display hierarchical categories/sub-categories for a single post only
- get posts, run a custom query, and join the results
- search form for custom fields
- Some custom post types did not return an object
- Display Post from Custom Post Type with Shortcode
- Modified core/image rendering not showing in posts – only on pages
- Not display an image of category of custom post
- Why do I have categories with duplicate slugs?
- Post relationships/nesting
- Is it possible to remove actual post pages in wordpress but keep them in categories
- WordPress not showing recent posts
- How to get post count including nested categories
- Multiple Custom Post Type loop logic
- How to show content of specific item on the same page?
- How can I display a specific number of post in a category via a url
- how to chang preview of list of articles of one category?
- Post of a specific category – not to be seen in paging previous/next post
- How to show main category related to that post
- Display selected category on post page
- Sort post by category using HTML Select tag
- Make assigning post to a specific category equivalent to assigning it to all categories
- How to use in_category?
- About number of posts in selected category
- First Custom Post Custom Fields Empty After New Custom Post
- Category page shows “No Posts” but I do have two assigned
- How to have more post in a page than in your home page
- ‘get_previous_post’ in same category returning (!empty) when no previous post in category exists
- Notify/check if the content of a custom gutenberg block has changed on save_post
- WordPress menu disappears in category pages