Skip to main content
added 1114 characters in body
Source Link
Cain
  • 1
  • 1
  • 4

EDIT:

This is my custom post type code

function my_post_type_portfolio() {
    register_post_type( 'portfolio',
                array(          
                'label' => __('portfolio'), 
                'singular_label' => __('portfolio', 'theme1418'),
                '_builtin' => false,
                'public' => true, 
                'show_ui' => true,
                'show_in_nav_menus' => true,
                'hierarchical' => true,
                'capability_type' => 'page',
                'menu_icon' => get_template_directory_uri() . '/includes/images/icon_portfolio.png',
                'rewrite' => array(
                    'slug' => 'portfolio',
                    'with_front' => FALSE,
                ),
                'supports' => array(
                        'title',
                        'editor',
                        'thumbnail',
                        'excerpt',
                        'custom-fields',
                        'comments')
                    ) 
                );

        register_taxonomy('portfolio_category', 'portfolio', array('hierarchical' => true, 'label' => 'portfolio', 'singular_name' => 'portfolio', "rewrite" => false, "query_var" => true));
}

add_action('init', 'my_post_type_portfolio');

EDIT:

This is my custom post type code

function my_post_type_portfolio() {
    register_post_type( 'portfolio',
                array(          
                'label' => __('portfolio'), 
                'singular_label' => __('portfolio', 'theme1418'),
                '_builtin' => false,
                'public' => true, 
                'show_ui' => true,
                'show_in_nav_menus' => true,
                'hierarchical' => true,
                'capability_type' => 'page',
                'menu_icon' => get_template_directory_uri() . '/includes/images/icon_portfolio.png',
                'rewrite' => array(
                    'slug' => 'portfolio',
                    'with_front' => FALSE,
                ),
                'supports' => array(
                        'title',
                        'editor',
                        'thumbnail',
                        'excerpt',
                        'custom-fields',
                        'comments')
                    ) 
                );

        register_taxonomy('portfolio_category', 'portfolio', array('hierarchical' => true, 'label' => 'portfolio', 'singular_name' => 'portfolio', "rewrite" => false, "query_var" => true));
}

add_action('init', 'my_post_type_portfolio');
Source Link
Cain
  • 1
  • 1
  • 4

Redirection error after posting a comment on a custom type post

I have created a custom post type called portfolio so the permalink structure for this type of posts is like this: mydomain.com/portfolio/post-name/

My issue is that after posting a comment on one of these posts i am redirected to mydomain.com//post-name#comment-id (notice how the word "portfolio" is missing) which causes a redirection loop error. I dont know whats the reason and i dont understand why is this happening.

I double checked my permlink structure and is set as mydomain.com/sample-post/ (post name) and I havent made any changes to the htaccess or whatsoever so what could be happening?

Please help.