Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wp_query post by category id

    $args=array(
    'posts_per_page' => 50, 
    'post_type' => 'my_custom_type'
    'cat' => $cat_id,
);
$wp_query = new WP_Query( $args );
Comment

wp_query post by category taxonomy

// If the taxonomy is the default category then:
$args = array( 
  'post_type'   => 'post',
  'category_name' => $category_name,
  'no_found_rows'          => true,
  'update_post_term_cache' => false,
  'update_post_meta_cache' => false,
);
$posts = new WP_Query( $args );
Comment

wp_query post id

$args = array(
	'post_type' => 'my_custom_type'
	'cat' => $cat_id,
);

$wp_query = new WP_Query( $args );

$wp_query->post->ID
Comment

wordpress query a post by id

/*
WordPress: Query a specific post by its post type & ID.
While editing the post, refer to the URL to find the Post ID Number.
e.g. http://...wp-admin/post.php?post=[Post ID Number]...

*/

// Query for a Case Study with ID #12345
<?php query_posts('post_type=case_studies&p=12345'); ?>
  
Comment

PREVIOUS NEXT
Code Example
Php :: php ini ubuntu 
Php :: mysql server has gone away php 
Php :: current loggedin user laravel 
Php :: woocommerce action order complete 
Php :: laravel collection remove duplicates 
Php :: php get random value from array 
Php :: wordpress throw to debug.log 
Php :: how to document php api with swagger 
Php :: minuscule chaine php 
Php :: swich in php 
Php :: redirect from controller in laravel 
Php :: seconds to days hours minutes seconds php 
Php :: wp_query post count 
Php :: phpunit stop on failure 
Php :: get number of chars ina string php 
Php :: command to run php file on chrome 
Php :: laravel display old value in form 
Php :: install php 7.4 ubuntu 
Php :: laravel validation allow empty array 
Php :: php artisan drop table 
Php :: array_search 
Php :: php serverpath 
Php :: setcookie in laravel 8 
Php :: php multi type parameter php multi type parameter 
Php :: php array_reverse keep keys 
Php :: method put laravel 
Php :: cache clear in laravel 
Php :: php compare two versions return true or false if version is big 
Php :: php echo 
Php :: how to get the list of available timezones in php 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =