get_posts()
uses WP_Query
, so you are probably providing wrong arguments, it’s worth mentioning that the function has some default arguments.
This should get all posts of the CPT myCPT
:
$args = array(
'posts_per_page' => -1,
'post_type' => 'myCPT',
'post_status' => 'any',
);
$posts_array = get_posts( $args ); ?>
Related Posts:
- How do I remove a pre-existing customizer setting?
- wp_redirect() – headers already sent
- The the_post_thumbnail without srcset?
- Enqueue Stylesheets After Theme’s “rtl.css”
- Why I can’t add a CSS style in this WordPress theme?
- Use __($str) and _e($str) to translate strings with HTML
- Posts in multiple Categories different single.php
- Single Page WordPress Theme – Using page templates
- Confused about image sizing business in WordPress
- Custom Theme: The active theme is broken. Reverting to the default theme
- Creating the modern ‘single page’ html5 css3 layout in wordpress
- How can I stop WP media uploader from creating duplicates of my uploaded images?
- Customize comment list markup
- Have WP Theme update from Git Repository
- Responsive Images – Generating multiple images from Theme Customizer control upload?
- How can a Theme Contain no Header File or Footer File?
- WordPress theme (or plugin) that uses Contenteditable property
- Can a child theme based on Starker theme be released as free to use theme for public use?
- Adding “latest from the blog” to the homepage
- Default comments file and how to copy it
- Changing order title and featured image in blog post (Astra theme)
- Is there a theme function for is_password_protected()?
- Some translations do not work in my template class
- Link won’t show using the_permalink();
- WordPress not registering Theme Customization Section
- How to get comment meta values by post ID
- Why is the Links Manager visible?
- Check if home.php and set home.php as page_on_front
- qTranslate with my own theme and settings
- Should I use add_filter for functions in function.php of the theme?
- Multiple TinyMCE Editors in one Admin Page
- Showing a list of posts when homepage is custom
- Do i need to keep all the default WP templates files in a theme?
- Create a new page in WordPress theme
- How to show user online status on their posts?
- What is the correct way of getting parent styles from child theme?
- How to display all subpages and short by year
- Retrieve localised value
- How to disable wordpress from overload my stylesheet styles with customizer styles
- AJAXIFY WordPress Theme Frontend menu
- How can my theme allow users to take advantage of advanced html tags in posts
- Pull request in WordPress repository?
- how to setup custom content structures
- How to Call pages from a Options Panel
- How can I conditionally show different home page templates based on whether or not the user is logged in?
- how to get the post attachement image in full size?
- Gallery thumbnails very small
- Is there a list of all display functions for templates? [closed]
- Featured Image meta box not showing up
- Why does WordPress append numbers to page slugs sometimes? How to reliably style based on page
- WordPress dummy data for theme design
- Using a starter theme vs starter theme with child theme
- How should I use starter content utility to show some default menus?
- Set a featured image as a replacement to the header image
- How to remove ID’s from wp_enqueue_style?
- Custom theme: How to call archive-post.php for viewing blog posts
- JQuery undefined and Stylesheet loads in bottom along with js files
- Why tags are displayed bellow the content and not inside
- What’s the best way to create a new design for other pages?
- Consequences if using PHP include TEMPLATEPATH?
- Adding a gallery to my first theme
- Headless WordPress + Vue.js on the same server
- How do I conditionally defer scripts based on the page name?
- How to place POST TITLE any location inside the posts page
- not getting API setting saved confirmation message after update on option page
- Do I need to re-import Susy to work with it in a child theme? [closed]
- Valid SQL query not returning results
- WP_Query not getting all posts, just tagged posts
- how to hide home nav link in wordpress
- Recommended sidebar / content widths
- Converting a theme to a child theme in a network
- Understrap-child conditional js script
- Why excerpt hook not working inside ajax function?
- Help with Core Mods
- How to make updatable custom WordPress theme?
- How can I access variables from theme in child theme? [closed]
- How to handle theme activation errors?
- Local variable name in setup_postdata()
- change background image on scroll
- Using wp_add_inline_style Inside a Template File
- how to edit woocommerce checkout page
- WordPress Twenty-Fourteen: How to Remove Home Page Header Image from Other Pages
- Display current taxonomy slug in a post
- How to create multiple customizer controls in one control
- Setting a fluid content width
- Modify comments_popup_link output
- How can I display and excerpt of all pages with a meta_key and meta_value on index.php?
- get_the_excerpt() removes all p tags in page!
- How to migrate the menu from the site on my own theme in WordPress?
- Why is including all your files within a theme folder important?
- Change default options on attachment page
- Enable WP to accept standard jQuery code embeding between the tags [duplicate]
- Pagination issue with Single.php
- php file child theme directory not overriding parent theme php file [duplicate]
- How do I change the tagline input to textarea?
- Creating completely new WordPress site from old WP contents
- can’t add EVENT LISTENER to a element
- Should I create a child theme for a parent custom theme? [closed]
- Configuring static page with add_rewrite_rule gives 404 after navigating to Permalinks admin panel
- How to Enable Hot Module Replacement with Webpack