WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom post type permalink not working (404) (5 posts)

  1. adrian7
    Member
    Posted 1 year ago #

    I have the following code

    $itemlabels = array(
    			'name' 					=>  _x('Items', 'post type general name', WPDEV_THEME_TEXTDOMAIN),
    			'singular_name' 		=> _x('Item', 'post type singular name', WPDEV_THEME_TEXTDOMAIN),
    			'add_new' 				=> _x('Add Item', 'classsified', WPDEV_THEME_TEXTDOMAIN),
    			'add_new_item' 		=> __('Add New Item ', WPDEV_THEME_TEXTDOMAIN),
    			'edit_item' 				=> __('Edit Item', WPDEV_THEME_TEXTDOMAIN),
    			'new_item' 				=> __('New Item', WPDEV_THEME_TEXTDOMAIN),
    			'view_item' 				=> __('Visit item page', WPDEV_THEME_TEXTDOMAIN),
    			'search_items'			=> __('Search Item', WPDEV_THEME_TEXTDOMAIN),
    			'not_found' 				=> __('No items found', WPDEV_THEME_TEXTDOMAIN),
    			'not_found_in_trash'	=> __('No items in trash', WPDEV_THEME_TEXTDOMAIN),
    			'parent_item_colon' 	=> '',
    			'menu_name' 			=> __('Marketplace', WPDEV_THEME_TEXTDOMAIN)
    	);
    	$itemargs = array(
    			'labels' 					=> $itemlabels,
    			'taxonomies'			=> array('category'),
    			'public' 					=> true,
    			'publicly_queryable'	=> true,
    			'show_ui' 				=> true,
    			'menu_icon'				=> (get_bloginfo('template_url') . '/images/market-icon.png'),
    			'show_in_menu' 		=> true,
    			'query_var' 				=> true,
    			'capability_type' 		=> 'post',
    			'has_archive' 			=> true,
    			'hierarchical' 			=> false,
    			'rewrite'					 => array('slug' => 'product'),
    			'menu_position' 		=> 7,
    			'supports'		    	=> array('title', 'author', 'editor', 'custom-fields', 'thumbnail')
    	);

    Registers the post type, assigns the taxonomy - but the permalink (e.g. http://example.com/product/new-item-2/) ALWAYS goes to 404 page!

    It is a WP bug - or it's only me?

  2. Anytime a new custom post type is registered the rewrite rules have to be flushed. Go to Settings -> Permalinks and click save.

  3. adrian7
    Member
    Posted 1 year ago #

    I have flushed them EVERYTIME!

    I might be wrong, but it might be a bug in WP 3.4.2...

    Had anyone tried registering a NEW custom post type with latest WP?

  4. adrian7
    Member
    Posted 1 year ago #

    I found the culprit. It's this plugin: http://wordpress.org/extend/plugins/kih-web-directory-wordpress-plugin/

    Once I deactivate it and re-saved permalink settings it worked. However I need to find another workaround, since I need that plugin.

  5. adrian7
    Member
    Posted 1 year ago #

    workaround found, commented the line nr.43 in kih-wp-links.php.

Topic Closed

This topic has been closed to new replies.

About this Topic