Wordpress 如何更改默认帖子的永久链接?
我想将默认帖子的永久链接更改为Wordpress 如何更改默认帖子的永久链接?,wordpress,Wordpress,我想将默认帖子的永久链接更改为\blog\post name,但同时我不想更改其他自定义帖子类型的永久链接。欢迎使用SO 请阅读此链接,了解如何 在每篇文章的下方,你可以看到它的永久链接,查看下面的图片。只需单击“编辑”并将其更改为您想要的任何内容 您可以在“仪表板>设置>永久链接”中更改“帖子”的永久链接结构 最终自定义Post类型的永久链接结构不会改变,因为通过插件或脚本为每个自定义Post类型设置了永久链接结构(仅供参考,它发生在'rewrite'=>数组('slug'=>'your cp
\blog\post name
,但同时我不想更改其他自定义帖子类型的永久链接。欢迎使用SO
请阅读此链接,了解如何
在每篇文章的下方,你可以看到它的永久链接,查看下面的图片。只需单击“编辑”并将其更改为您想要的任何内容
您可以在“仪表板>设置>永久链接”中更改“帖子”的永久链接结构
最终自定义Post类型的永久链接结构不会改变,因为通过插件或脚本为每个自定义Post类型设置了永久链接结构(仅供参考,它发生在
'rewrite'=>数组('slug'=>'your cpt Permalink slug')
指令中)。创建自定义Post类型。别忘了更改文本域“booksinfo”
将此代码添加到functions.php
function blog_post_type() {
// Set UI labels for Custom Post Type
$labels = array(
'name' => esc_html__( 'Blogs', 'booksinfo' ),
'singular_name' => esc_html__( 'Blog', 'booksinfo' ),
'menu_name' => esc_html__( 'Blogs', 'booksinfo' ),
'parent_item_colon' => esc_html__( 'Parent Blog', 'booksinfo' ),
'all_items' => esc_html__( 'All Blogs', 'booksinfo' ),
'view_item' => esc_html__( 'View Blog', 'booksinfo' ),
'add_new_item' => esc_html__( 'Add new Blog', 'booksinfo' ),
'add_new' => esc_html__( 'Add New', 'booksinfo' ),
'edit_item' => esc_html__( 'Edit Blog', 'booksinfo' ),
'update_item' => esc_html__( 'Update Blog', 'booksinfo' ),
'search_items' => esc_html__( 'Search Blog', 'booksinfo' ),
'not_found' => esc_html__( 'Not Found', 'booksinfo' ),
'not_found_in_trash' => esc_html__( 'Not found in Trash', 'booksinfo' ),
);
// Set other options for Custom Post Type
$args = array(
'label' => esc_html__( 'blog', 'booksinfo' ),
'description' => esc_html__( 'blogs news', 'booksinfo' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments', 'revisions', ),
'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,
'capability_type' => 'page',
'menu_icon' => 'dashicons-star-empty',
'taxonomies' => array( 'post_tag','category'),
);
// Registering your Custom Post Type
register_post_type( 'blog', $args );
}
add_action( 'init', 'blog_post_type', 0 );
你可以在每个post BASICAN上更改permalink你告诉我plz@entre@Mudassarali你是如何通过编程实现的?我是如何改变帖子类型为“post”的永久链接的?我想通过编程实现。你可以使用重定向插件及其相关设置来实现你的插件,尽管这是一种解决方法,而不是实际的解决方案