Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress Custom Post Type Archive Issue
    primarykey
    data
    text
    <p>I have a blog with a custom post type inited like:</p> <pre><code>register_post_type( 'type', array( 'labels' =&gt; array( 'name' =&gt; __( 'Types' ), 'singular_name' =&gt; __( 'Type' ) ), 'public' =&gt; true, 'has_archive' =&gt; true, ) ); </code></pre> <p>Obviously this is wrapped in a function that is called by the init action. Problem is that this post type is full of posts, over 1K, but on the archive page (domain.com/type) there is nothing showing. I tried to verify the query, but the query is showing up as NULL. Anyone have a reliable solution?</p> <p>PS - This is why I hate wordpress. Never works right. </p> <p>Tags: wordpress-broken-again, wordpress-sucks, wordpress-i-hate-you</p> <p>Full excerpt:</p> <pre><code>function cp_init_types() { register_post_type( 'nursing-home', array( 'labels' =&gt; array( 'name' =&gt; __( 'Nursing Homes' ), 'singular_name' =&gt; __( 'Nursing Home' ) ), 'public' =&gt; true, 'has_archive' =&gt; true, 'rewrite' =&gt; array( 'slug' =&gt; 'nursing-homes', 'with_front' =&gt; true ), /*'supports' =&gt; array( 'title', 'editor', 'custom-fields', 'thumbnail' ), 'publicly_queryable' =&gt; true, 'exclude_from_search'=&gt; false, 'taxonomies' =&gt; array('category','post_tag'),*/ ) ); flush_rewrite_rules( false ); } function add_my_post_types_to_query( $query ) { if(is_category() || is_tag() || is_home() &amp;&amp; empty( $query-&gt;query_vars['suppress_filters'] ) ) { $post_type = get_query_var('post_type'); if($post_type) { $post_type = $post_type; } else { $post_type = array('post','nursing-home','nav_menu_item'); } $query-&gt;set('post_type', $post_type); return $query; } return $query; } // Show posts of 'post', 'page' and 'movie' post types on home page add_action( 'pre_get_posts', 'add_my_post_types_to_query' ); add_action("init", "cp_init_types"); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload