How to get all post of custom post type by rest api?

The REST API supports grabbing a maximum of 100 posts at a time, so you’ll have to make an additional call for every 100. Start with wp_remote_get() for 100 posts. While you’re at it, go ahead and retrieve the body of this page and decode it: $transcripts = wp_remote_get(‘http://example.com/wp-json/wp/v2/transcript/?per_page=100’); $transcriptsBody = wp_remote_retrieve_body($transcripts); $transcriptsDecoded = json_decode($transcriptsBody, … Read more

i cant see the max_num_pages of a custom wp query

Your variables are not in functions scope. My example of function: function customPagination($paged = ”, $max_page=””) { global $wp_query; $big = 999999999; if( ! $paged ) $paged = get_query_var(‘paged’); if( ! $max_page ) $max_page = $wp_query->max_num_pages; echo paginate_links( array( ‘total’ => $max_page, ‘prev_next’ => false, ‘prev_text’ => false, ‘next_text’ => false, ‘total’ => $wp_query->max_num_pages, ‘mid_size’ … Read more

WordPress custom post type capabilities issue

You definitely need to set map_meta_cap to true instead of false to create custom capabilities. I haven’t seen the ‘capability_type’ => [‘note’,’notes’] way of creating capabilities before – maybe it’s shorthand, but if just changing map_meta_cap doesn’t work, you might want to spell everything out the long way: <?php $args = array( ‘labels’ => $labels, … Read more

Querying & displaying custom post type into an existent page [closed]

You can create a shortcode and add it in any page you want. This code will register your custom shortcode: add_action( ‘init’, ‘register_custom_shortcodes’ ); function register_custom_shortcodes(){ add_shortcode( ‘my-custom-shortcode’, ‘display_movies’ ); } This code will be responsible for the content that will be displayed wherever you place the shortcode: function display_movies(){ ob_start(); //Your code here to … Read more

Custom Taxonomy Is Being Pulled into a Page, But It Doesn’t Have A Hyperlink

@Chewy you can try below code snippet. <p class=”cat”> <?php $terms = get_the_terms($post->ID, ‘news_categories’); foreach ($terms as $term) { $term_id = $term->term_id; $term_name = $term->name; $term_link = get_term_link( $term_id ); echo “<a href=””.$term_link.””>”.$term_name.”</a>”; } ?> </p> please chcek and let me know if this work or not. if not then please ping me I will … Read more

Trying to get custom post of a custom taxonomy

I can’t get the first bit to work, I can’t get the taxonomy to return the post. So the following is the first bit which queries posts in a single taxonomy term: $posts_array = get_posts( array( ‘showposts’ => -1, ‘post_type’ => ‘treatment’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘treatment_type’, ‘field’ => ‘term_id’, ‘terms’ => $term->slug, … Read more

Make custom post type a media library

While a Media Item is stored as a semi-regular “post-type” named attachment, the edit page and the scripts that get called when you want to edit or upload an attachment are completely different. You won’t be able to recreate the media library without some SERIOUS programming efforts.