I’ll keep looking into more. I did change to default permalinks to make sure the correct parameters were showing in the url string when clicking to the next page, which they were.
I really am stumped. On a different note. I checked the CPT archive page and checked a normal category archive page and it paginates correctly.
So I assume it is definitely with my Custom Taxonomy.
I think the SQL that was outputing that the top of the page was something that is in the Admin Bar so my mistake on that.
Lastly when running this query in PHPMYADMIN
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (23) ) AND wp_posts.post_type = 'ddc_products' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 12, 12
The expected output of two products is returned
I guess the next thing is to check my CPT and Taxonomy registration
Here is that code, does anything seem wrong with it?
// Register Custom Taxonomy
function ddc_create_taxonomies() {
$labels = array(
'name' => _x( 'Categories', 'Taxonomy General Name', 'text_domain' ),
'singular_name' => _x( 'Category', 'Taxonomy Singular Name', 'text_domain' ),
'menu_name' => __( 'Categories', 'text_domain' ),
'all_items' => __( 'All Categories', 'text_domain' ),
'parent_item' => __( 'Parent Category', 'text_domain' ),
'parent_item_colon' => __( 'Parent Category:', 'text_domain' ),
'new_item_name' => __( 'New Category Name', 'text_domain' ),
'add_new_item' => __( 'Add New Category', 'text_domain' ),
'edit_item' => __( 'Edit Category', 'text_domain' ),
'update_item' => __( 'Update Category', 'text_domain' ),
'separate_items_with_commas' => __( 'Separate Categories with commas', 'text_domain' ),
'search_items' => __( 'Search Categories', 'text_domain' ),
'add_or_remove_items' => __( 'Add or remove Categories', 'text_domain' ),
'choose_from_most_used' => __( 'Choose from the most used Categories', 'text_domain' ),
);
$rewrite = array(
'slug' => 'products/category',
'with_front' => false,
'hierarchical' => true,
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_tagcloud' => true,
'rewrite' => $rewrite,
);
register_taxonomy( 'ddc_product_categories', 'ddc_products', $args );
}
// Hook into the 'init' action
add_action( 'init', 'ddc_create_taxonomies' );
function ddc_create_post_types() {
//Register Support Topics
$labels = array(
'name' => 'Products',
'singular_name' => 'Product',
'add_new' => 'Add New',
'add_new_item' => 'Add New Product',
'edit_item' => 'Edit Product',
'new_item' => 'New Product',
'view_item' => 'View Product',
'search_items' => 'Search Products',
'not_found' => 'No Products found',
'not_found_in_trash' => 'No Products found in Trash',
'parent_item_colon' => 'Parent Product:',
'menu_name' => 'Products',
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'description' => 'Products',
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'revisions', 'genesis-cpt-archives-settings', 'genesis-seo' ),
'taxonomies' => array( 'ddc_product_categories' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 20,
//'menu_icon' => 'this.jpg',
'publicly_queryable' => true,
'exclude_from_search' => true,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => array( 'slug' => 'products' ),
'capability_type' => 'post'
);
register_post_type( 'ddc_products', $args );
}
add_action( 'init', 'ddc_create_post_types' );