$args = array(
'post_type' => 'carousel',
'suppress_filters' => 0,
'numberposts' => -1,
'order' => 'ASC'
);
$content_block = get_posts( $args ); // there was a typo in this line
var_dump($content_block); // it should work fine now
PS. I’m not sure why do you need “an object” and you can’t do it with custom WP_Query. In the end, get_posts
function builds custom WP_Query and returns result of it… 😉
http://core.trac.wordpress.org/browser/tags/3.5.2/wp-includes/post.php#L1723
Related Posts:
- Use get_post_types to query only custom posts types
- How to add post type in masonry posts elementory widget
- Pagination not working with custom loop
- Use register_post_type() to modify an existing post type
- Get the ID of the latest post
- Custom post type pagination 404 fix?
- Per Post Type Revision Numbers
- Get list of all registered post types slugs
- Sort custom post type list table by display name of a user id stored as post meta value
- How to use a custom post type as front page?
- Random post, once per day
- get attachments for all posts of particular post type
- Query custom post type by custom field
- WP_Query ignores post_type in category view
- How to get only posts, pages and custom post types in WordPress
- Add Custom Post Type to Current Query
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- How do I implement custom fields without using any plugins?
- custom post types don’t appear in RSS
- Better to use a post type archive, page template, or shortcode for generating a highly configurable CPT archive?
- SQL to update custom post taxonomies
- Query multiple taxonomy in Custom Post Type
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Querying Posts by Taxonomy From Alternate Network Site
- Custom Search | Wrong output & question
- Get the most popular terms for a custom post type
- Query by 2 values of a repeater ACF field
- show posts only on homepage but using custom post type and taxonomy for query posts via url
- Registered Post Type Isn’t Showing in Admin Menu
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- WP insert post PHP function dynamically generated Custom Fields
- Include both default and Custom Post Type in query modified inside pre_get_posts
- Query posts between two dates (custom meta keys) CMB2
- $wpdb returns no results with SELECT query on custom post type, works on default post type
- Include different loop templates in search query
- Adding posts of custom type into the main feed
- Custom Post Types, Page Templates and Pagination. Why do I get a 404 Error?
- Inserting data into `post meta` table?
- Custom Select Query with Custom Post Types
- Automatically adding meta data to posts or multiple query help
- Having trouble with custom date field for CPT query (WordPress)
- Custom Post Type order by modified date and custom meta field issue
- Sort posts based on multiple custom fields
- WP_Query search posts by custom post type and custom taxonomy
- Calculating Bayesian average for custom post type
- Conditional to modify query results
- Multiple post type queries (with specific arguments for each)
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Selecting New & Edit Page for Custom Post Types
- Show Two custom Post type and their posts on category page
- How to filter custom taxonomy categories on archive?
- How to retrieve a custom post’s capability?
- Modifying date filter on admin page for custom post type to link to custom field
- Ignore sticky posts if post is not in meta query
- Querying Term Posts in Loop
- How to debug a blank page?
- query posts and custom post type with meta key
- WordPress Orderby Numeric Value Not Working
- Query string parameters from custom fields, inconsistent results
- WP_Query | ‘post_type’ doesn’t work
- Custom Post type is being ignored in query
- Query custom post type only if it contains another custom post type
- Add post_type to index.php
- Order By Post Type ThenBy Taxonomy
- Custom query to filter posts that have current post as a taxonomy [closed]
- Am unable to reset a query properly
- Custom post type redirected to homepage – how to debug
- How to modify archive query with pre_get_posts to append CPTs?
- Get next and previous 3 posts in a term in single post page
- convert custom query to wp_query
- Making certain categories of CPT not publicly queryable
- Search / Filter posts on Title/Content OR Tags
- child of post type (custom)
- Get parse_query filter to return slug instead of id
- Querying both pages and posts
- Meta query for custom post type ignored in main query
- Querying Two Custom Post Types with OR Not Working
- How do I move/order posts with a tag to the end?
- How do I set default meta value by post type?
- Limit amount of posts made within a custom taxonomy
- Incorrect post_type in url of taxonomy term
- creat filter with wp_query
- Specific query for custom post type
- Display post content with respect to its title?
- First custom field value (out of several) displayed twice after query
- Prioritize posts in query by meta keys?
- What’s the equivalent of Hide From Menus on MODX on WordPress?
- How to define which register_post_status goes to which register_post_type?
- WP_Query orderby and tax_query
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Displaying Posts from Custom Post Types
- Different Ways to Query Custom Post Types?
- How to organise this data within WordPress
- Custom post type posts don’t show in archive widget
- Showing specific post in order of array wp_query
- Is it possible to filter the display name for post formats for display in the Formats meta box?
- get_the_post_thumbnail_url(‘full’) returns empty from custom post type
- single-{post_type}.php not working
- How to Set Taxonomy Object Description?