[Support request] Strange Custom Post Type problem

Home Forums Support [Support request] Strange Custom Post Type problem

Home Forums Support Strange Custom Post Type problem

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #589777
    Andy

    Hi,

    I’ve just started setting up a Custom Post Type and Custom Taxonomy. Everything appeared to work fine. Then I imported some sample posts to test, each post uses ACF custom fields.

    But, I have discovered something very odd is happening on the archive page. I imported 15 sample posts and it displays in total 15 posts.
    However, it isn’t displaying every post, it is displaying 7 or 8 posts and then displaying 2 or 3 posts twice making a total of 15.

    Things I’ve tried so far:

    Clearing Litespeed Cache
    Disabling Plugins
    Switching to Twenty Seventeen theme and adding CPT to 2017 functions file to test, the issue remains
    Saving Permalinks several times
    Removed ACF fields from post templates

    Please see my CPT and Custom Taxonomy code below, I’ve also included URL and front-end password in the URL field for this post, any help would be very much appreciated:

    add_action( 'init', 'companies_post_type' );
    /**
     * Register Retailers post type.
     *
     */
    function companies_post_type() {
        $labels = array(
            'name'               => _x( 'Companies', 'post type general name', 'companies' ),
            'singular_name'      => _x( 'Company', 'post type singular name', 'companies' ),
            'menu_name'          => _x( 'Companies', 'admin menu', 'companies' ),
            'name_admin_bar'     => _x( 'Company', 'add new on admin bar', 'companies' ),
            'add_new'            => _x( 'Add New', 'company', 'companies' ),
            'add_new_item'       => __( 'Add New Company', 'companies' ),
            'new_item'           => __( 'New Company', 'companies' ),
            'edit_item'          => __( 'Edit Company', 'companies' ),
            'view_item'          => __( 'View Company', 'companies' ),
            'all_items'          => __( 'All Companies', 'companies' ),
            'search_items'       => __( 'Search Companies', 'companies' ),
            'parent_item_colon'  => __( 'Parent Companies:', 'companies' ),
            'not_found'          => __( 'No companies found.', 'companies' ),
            'not_found_in_trash' => __( 'No companies found in Trash.', 'companies' )
        );
    
        $args = array(
            'labels'             => $labels,
                    'description'        => __( 'Companies', 'companies' ),
            'public'             => true,
            'taxonomies' => array('category'),
            'publicly_queryable' => true,
            'show_ui'            => true,
            'show_in_menu'       => true,
            'query_var'          => true,
            'capability_type'    => 'post',
            'has_archive'        => true,
            'hierarchical'       => false,
            'menu_position'      => 20,
            'menu_icon'             => 'dashicons-groups',
            'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
        );
    
        register_post_type( 'companies', $args );
    
        }
    
        /**
             * Create Type of Business custom taxonomy for companies
             */    
            function create_companies_taxonomy() {
                $labels = array(
                    'name'              => _x( 'Type of Business', 'taxonomy general name' ),
                    'singular_name'     => _x( 'Business', 'taxonomy singular name' ),
                    'search_items'      => __( 'Search Businesses' ),
                    'all_items'         => __( 'All Businesses' ),
                    'parent_item'       => __( 'Parent Business' ),
                    'parent_item_colon' => __( 'Parent Business:' ),
                    'edit_item'         => __( 'Edit Business' ), 
                    'update_item'       => __( 'Update Business' ),
                    'add_new_item'      => __( 'Add Business' ),
                    'new_item_name'     => __( 'New Business' ),
                    'menu_name'         => __( 'Type of Business' ),
                );
            
            $args = array(
                'labels' => $labels,
                'hierarchical' => true,
                'query_var' => true,
                'rewrite' => true,
                'show_admin_column' => true
            );
            
            register_taxonomy( 'business_type', 'companies', $args );
                    
    }
    
    add_action( 'init', 'create_companies_taxonomy', 0 );
    GeneratePress 2.1.2
    GP Premium 1.6.2
    #589799
    Leo
    Staff
    Customer Support

    Hi there,

    If the issue remains in twenty seventeen, I’m not sure how much we can do from GPs end here.

    Maybe try starting a with WordPress support? or someone on Stackoverflow might be able to give you an answer too: https://stackoverflow.com/

    #589860
    Andy

    Hi,

    It just doesnt make any sense, even if I import the posts into the standard blog ‘Posts’ section it does the same thing. It must be the Import plugin I’m using.

    #589905
    Tom
    Lead Developer
    Lead Developer

    It could be the import plugin, or something corrupted within your import file. Sounds very strange indeed.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.