That is a very broken Loop. The results of a new WP_Query
is not a simple array that you can foreach
over. It is far more complicated than that. Try var_dump($work_galleries);
.
Fortunately, WP_Query
provides methods to make looping easy.
$work_galleries = new WP_Query($args);
if ($work_galleries->have_posts()) {
while ($work_galleries->have_posts()) { // this replaces foreach
$work_galleries->the_post(); // this sets up the post data so functions like the_title() work
// now your code
}
}
Related Posts:
- How do I append multiple taxonomies to the URL?
- Creating “static” taxonomies to choose from, inside custom post type?
- Custom Post Type with Custom Title
- Shortcode to display Staff post type based on Location post type and Specialty post type
- Redirect to another page using contact form 7? [closed]
- Get Posts by Category, Tag , and CPT Taxonomy
- Shortcode to return single custom post based on post taxonomy
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Question about link two types of data in wordpress
- wp_set_object_terms creates taxonomies but does not add custom posts to it
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- editing shortcode for custom post type within a plugin
- Set a Default CPT taxonomy by taxonomy id
- Convert attribute woocommerce terms (taxonomy terms) in posts of custom post type
- Sort by Custom Post Type (Multiple Loop)
- Using get_terms() as shortcode attribute
- Query multiple post of which one by taxonomy
- Custom Post Type – List all attachments on Edit Screen
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- Order By Post Type ThenBy Taxonomy
- How to show CPTs in term archive
- Custom query to filter posts that have current post as a taxonomy [closed]
- How do I get array of types associated with a taxonomy?
- How to create shortcode to display custom field value on a custom post type
- Group posts by custom post type
- How to enable shortcodes in a custom post type?
- Tag page with Custom Post Types not returning any posts
- Custom Page that comes with preloaded content for the user
- wp_set_object_terms() not adding new term to custom post and custom taxonomy
- Display all posts in main category and 1 subcategory
- Get custom fields from a custom post type with a shortcode
- Shortcode for display posts in wp-editor
- Display Recently Added Custom Post Types with Custom Taxonomy Shortcode
- How inefficient is it to use a Custom Post for 4-5 sentences & pull all to 1 page?
- Update permalinks when new category added to custom post type taxonomy
- Show category ID on custom post type
- wp_get_post_terms on custom post type with custom taxonomies returning an empty array
- How to check post type (to include custom css)
- How to customize a permalink (URL) structure?
- Plugin: register custom post types, child ready and performance best practices
- Display only one post each WEEK
- Custom Taxonomies not appearing in Admin
- How to Mass Delete Images from Media Library
- Get custom post type list for every category shortcode
- Custom Post Type Set Comments ON by default without show METABOX
- Custom Post Type Taxonomy Filters
- How do I do this with WordPress? Taxonomies?
- Permalink structure by Post Meta value
- How to integrate video slide using custom post types?
- Is using taxonomies the way to go here or would custom post types be better?
- Using default WP menu functionality to link to custom post-type listing?
- Can taxonomies of custom post types be used with category actions?
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- A question on creating filters for custom posts using taxonomy
- Conditional Query of Custom Post Type and custom taxonomy
- will post_id ever change? Can I safely use post_id for custom queries?
- List custom taxonomy specific to one custom post type
- Define new user capability for custom post types?
- Custom Taxonomy back-end customizations
- How to allow visitors to enter custom post type?
- Is it possible to create relational metabox values in a custom post?
- Custom Post Type Query for Sidebar Doesn’t Work on Front Page
- Meta query for custom post type ignored in main query
- Taxonomy custom post type URL
- 2 Templates 1 custom post type according url
- How do I move/order posts with a tag to the end?
- changing meta value and meta key of price field
- How to build custom route by adding taxonomies to URL ? ex: www.demo.com/communities/palo-alto/
- WordPress sort search results by custom order
- How to Filter custom post type by taxonomy?
- Is it possible to have dedicated page for parent/child taxonomy?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Hide parent categories when clicked, and show it’s childs
- Custom Path/Folder behind a custom post type
- Custom post taxonomies as tax_query terms?
- Get related posts of child term of custom post type
- Limit amount of posts made within a custom taxonomy
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- Time based access control of custom post types – what is good approach?
- Show titles, date of all posts on single category page
- list taxonomies from a custom post type
- Display a grid of taxonomy terms at root taxonomy page
- delete_published_posts does not work
- How to start a new post with custom Taxonomies already set?
- WooCommerce sort products by the actual product width(not the shipping width)
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- Show child custom post types list inside single parent custom post type
- limit value taxonomy based on previous taxonomy value wordpress
- How to render a custom post type template with custom fields using shortcode
- Create a custom php page and load it at a specific slug
- Structure of data : CPT + terms
- How to handle paged param in post and custom-post-type?
- Several post types on WP Query by tag and taxonomy
- Default text in a specific post type, but not visible?
- Using meta_query and tax_query at the same time
- Form action/link to render a plugin in WordPress front-end
- Update postmeta Parent when post_status child change
- custom post type category count shortcode