Your foreach is way wrong. Try combining the category ids in an array, then running one query only to get the posts you want.
Edit: read your comments. Try use using an array function like array_merge instead of the + to combine the resulting post arrays. See if that helps.
Related Posts:
- Display all posts from specific categories on a page
- How to show list of posts by author and category?
- Divide Loop Into Days & Categories
- How to filter posts that belong to a specific category only if that is the only category
- Display post category in foreach loop with category link
- Exclude category from
- Pulling in post category and children within category
- Listing Specific Categories from Current Post with Depth
- How to make the first post in the loop be styled like a “new / featured” post?
- How do I stop the loop from repeating in my category template?
- get_the_category listing in hierarchial order
- why does wordpress ignore the post args?
- Showing categories and subcategories with posts
- WP_Query of Category Not Showing First Post
- Get post category as a separate string and url
- posts going to 2 pages/categories only show up in 1
- Get current taxonomy and display query accordingly
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Current post categories and subcatecories outside of the loop
- How to distinguish pages created by woocommerce?
- How to show category image if no featured image is set?
- Display new posts categories in separated divs
- List Authors For Current Category
- Multiple Post Repeat for Related Post Loop by Category
- Show post if in category
- Displaying categories items among posts
- Make assigning post to a specific category equivalent to assigning it to all categories
- Show all posts in category
- View post with specific category id and name which I selected in the backend (drop-down option)
- Including categories in search results
- How set featured posts using checkbox in post edit screen?
- Inject post (from specific category) between posts in Loop
- WP_Query: Why is sticky post not first item in loop?
- Query posts from current year
- How to use alternate post layout at key points in post loop?
- Showing random content / pictures from earlier posts in a sticky post?
- Limit function to specific post category
- Show all post titles
- Double count view in archive.php
- Posts are not showing up on particular category
- Different style for most recent article
- Differentiate between posts and pages in search results
- How to display related posts by subcategory and not parent category
- Category Template: Need to display different content on first page of archives
- Extracting post categories
- Using wp_list_categories like the the_category (showing just current categories of a post)
- Should I use posts or pages in this scenario?
- How to allow users to post only in certain category and hide elements from edit page?
- Need help with category listing!
- Prepending %category% onto default posts fails
- List all categories with featured image from post?
- How to setup a query to output posts by groups of five?
- How to order posts in an arbitrary order?
- How to add a class to each individual post?
- How can you display all sibling categories to a post?
- How can I remove the first two words and shorten get_the_title()
- How to create a “latest news” page showing a list of posts from blog category
- ACF to select posts not displaying on blog page
- how to hide empty fields of post category description?
- Querying another post category to match current post and display in loop
- How to have more than one page for your posts if you have 8 posts but can store max 4 on a page
- Extract wordpress posts content and category content
- All categories displays the same posts
- Having pages after specifying post_type post
- how to handle the loop using filling bootstrap grid structure?
- WordPress loop not working on static front page
- Get latest post from categories
- Display specific posts on home page
- The loop starting at a certain ID
- Loop not showing first post
- How to show a featured image inside a post in only 1 single category
- Custom Post Type Single Loop Outputting Wrong Post
- Geting error in post and category [closed]
- Display most recent posts in category with Twenty Ten theme widget
- Multiple post in One Loop in wordpress
- Does having category name in permalinks affect SEO when having a post in multiple categories?
- Diffrent layout for posts [duplicate]
- How to 301 redirect from url with post id to permalink with post name (slug)?
- Create/Set Category as Title of Post
- How to display related post from same category in single.php
- Save All Post Permalink From A Specific Category into a .txt file
- get current index of post content in category page
- Get 5 most recent categories
- Dynamically load posts based on category
- Get Categories & Posts With Type Article
- Show post excerpt
- WordPress infinite post cycle problem
- Set multi posts random categories and tags
- Add new post only in assigned category
- List of authors posts minus very latest
- show latest authors blog post
- Admin Post List Only Show One Category
- Add category attribute to custom recent post shortcode
- Same sidebar in all posts as in the category
- Retrieve latest post by multiple categories with ID
- How to display only one post on first category page and rest on next pages?
- Is there a way to separate wordpress titles from their posts?
- Redirecting posts in WordPress to a specific page
- Show Title/Date/Excerpt of first post & only Title for rest in Query [duplicate]
- Show some texts in posts belonging to Specific category