I’m using custom post types UI
plugin on my website.
Now I have blog posts ( default wp posts – news ) and a new custom post type ( articles ).
I want to show all the posts for these two post types on another page.
but I can not combine this two together!
Here is what i’m using to show articles posts:
public function News() {
$terms = get_terms(['post_type' => 'articles','taxonomy' => "article_category",'hide_empty' => false,]);
2
Answers
Hi if WP Query does not work for you, you can try and get the id’s of these two types. Then make a function that pulls the information that you need from each one based on their id’s.
This could easily be done by using
wp_query
. Please avoid writing your own sql queries as much as possible because thesecustom sql queries
would potentially make you vulnerable toslq attacks
. You could combine your post types like this'post_type' => array( 'post', 'articles' )
.