• Resolved Jan Koester

    (@dasmaeh)


    I’ve coded a plugin creating a custom post type. In my development environment in a single install everything is working fine.
    On my production site (multisite) however if I create posts of that post type they neither show up in the posts list of that post type not on the front. The counter above the post list correctly stats the number of posts and I can also find them in the database. The list however is empty.
    The cpt is created like here: https://codex.www.ads-software.com/Post_Types#Custom_Post_Types and I’ve also noticed the problem with opther plugins going the same way.
    So I guess I (and others) are doing something wrong with setting up the post type or I messed something up during setup.

    Any ideas how to start debugging?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Jan Koester

    (@dasmaeh)

    WP_DEBUG is giving me this:
    Notice: Array to string conversion in /var/www/blogs/wp-admin/edit.php on line 225

    If I print this array, it even contains the wrong post type(s) post and recipe.

    The error persists if I reduce the function of the plugin to just create the posttype:

    register_post_type( 'rpr_recipe',
    	    	array(
    		    	'labels' => array(
    			    	'name' => $name,
    			    	'singular_name' => $singular,
    			    	'add_new' => __( 'Add New', $this->pluginName ),
    			    	'add_new_item' => __( 'Add New', $this->pluginName ) . ' ' . $singular,
    			    	'edit' => __( 'Edit', $this->pluginName ),
    			    	'edit_item' => __( 'Edit', $this->pluginName ) . ' ' . $singular,
    			    	'new_item' => __( 'New', $this->pluginName ) . ' ' . $singular,
    			    	'view' => __( 'View', $this->pluginName ),
    			    	'view_item' => __( 'View', $this->pluginName ) . ' ' . $singular,
    			    	'search_items' => __( 'Search', $this->pluginName ) . ' ' . $name,
    			    	'not_found' => __( 'No', $this->pluginName ) . ' ' . $name . ' ' . __( 'found.', $this->pluginName ),
    			    	'not_found_in_trash' => __( 'No', $this->pluginName ) . ' ' . $name . ' ' . __( 'found in trash.', $this->pluginName ),
    			    	'parent' => __( 'Parent', $this->pluginName ) . ' ' . $singular,
    			    	),
    		    	'public' => true,
    		    	'menu_position' => 5,
    		    	'supports' => array( 'title', 'thumbnail', 'comments' ),
    		    	'taxonomies' => $taxonomies,
    		    	'menu_icon' =>  $this->pluginUrl . '/img/icon_16.png',
    		    	'has_archive' => true,
    		    	'rewrite' => array(
    			    	'slug' => $slug
    			    	)
    	    	)
    		);
    Thread Starter Jan Koester

    (@dasmaeh)

    My mistake. The theme was also manipulating the query leading to this unwanted result.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom post type in multiste – posts not showing up’ is closed to new replies.