मेरे पास 2 कस्टम पोस्ट प्रकार पोस्ट हैं। वीडियो पोस्ट और सिटी-गाइड पोस्ट पहला पोस्ट (वीडियो पोस्ट) में यूआरएल है: 104.130.239.132/rick-owens/ और दूसरा पोस्ट (सिटी -गुइड पोस्ट) conatins url: http://104.130.239.132/city-guide/rick-owens/ (शहर-गाइड परमालिंक संरचित है जो कस्टम पोस्ट प्रकार का नाम है)। इसलिए जब भी हम पहले यूआरएल तक पहुंचने का प्रयास करते हैं तो यह समस्या यहां आती है, यह टेम्पलेट और दूसरी यूआरएल की सामग्री प्रदर्शित करती है। दूसरा यूआरएल नवीनतम प्रकाशित होता है। मैंने योआस्ट एसईओ प्लगइन को अक्षम करके हल करने के लिए खुद से कोशिश की, अभी भी कोई बदलाव नहीं हुआ और मेरा भी परमालिंक ताज़ा अभी भी एक ही परिणाम मिला है। और दूसरा यूआरएल पोस्ट की Yoast एसईओ टुकड़ा किसी भी मदद की सराहना की जाएगी, धन्यवाद:एक ही स्लग के साथ कस्टम पोस्ट एक ही स्लग के साथ गलत पोस्ट पर रीडायरेक्टिंग
पहले यूआरएल पद के लिए Yoast एसईओ टुकड़ा अटैच किया जा रहा।
अतिरिक्त:
यहां मेरे सीपीटी कोड हैं।
1.Video पोस्ट:
$labels = array(
'name' => _x('Videos', 'Post Type General Name', 'roots'),
'singular_name' => _x('Video', 'Post Type Singular Name', 'roots'),
'menu_name' => __('Video Posts', 'roots'),
'parent_item_colon' => __('Parent Video:', 'roots'),
'all_items' => __('All Videos', 'roots'),
'view_item' => __('View Video', 'roots'),
'add_new_item' => __('Add New Video', 'roots'),
'add_new' => __('Add New', 'roots'),
'edit_item' => __('Edit Video', 'roots'),
'update_item' => __('Update Video', 'roots'),
'search_items' => __('Search Video', 'roots'),
'not_found' => __('Not found', 'roots'),
'not_found_in_trash' => __('Not found in Trash', 'roots'),
);
$rewrite = array(
'slug' => 'rewrite',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => __('video', 'roots'),
'description' => __('Videos Post Type', 'roots'),
'labels' => $labels,
'supports' => array('title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields',),
'taxonomies' => array('category', 'post_tag'),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capability_type' => 'post',
'yarpp_support' => TRUE
);
register_post_type('video', $args);
2.City गाइड पोस्ट:
function register_post_types(){
register_post_type('city-guide', [
'has_archive' => TRUE,
'hierarchical' => TRUE,
'labels' => [
'name' => 'City Guide'
],
'public' => TRUE,
'supports' => ['editor', 'page-attributes', 'revisions', 'thumbnail', 'title','custom-fields','excerpt'],
'taxonomies' => array('post_tag')
]);
add_image_size('ipad-city-thumb', 650, 650, TRUE);
}
add_action('init', __NAMESPACE__.'\register_post_types', 20);
मैं अपने कोड
remove /rewrite/ slug from custom permalinks, to allow domain/slug for all post types
public function post_link_rewrite($post_link, $post, $leavename){
$post_link = str_replace('/rewrite/', '/', $post_link);
return $post_link;
}
क्या आप रजिस्टर कस्टम पोस्ट प्रकार कोड plz दिखा सकते हैं? –
@AshPatel hi मैंने अपने कोड जोड़े हैं। कृपया एक देखें – Melvin