markdown WordPress将Post文章类型更改为另一个

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown WordPress将Post文章类型更改为另一个相关的知识,希望对你有一定的参考价值。

Add this function to register_custom_types.php below the function radicati_theme_init() section. Then call it inside the init.

```php

function radicati_theme_init() {
  ...
  lots of other stuff, including:
  // Hide the default tags for posts
  unregister_taxonomy_for_object_type( 'post_tag', 'post' );

  // Also hide categories from posts
  unregister_taxonomy_for_object_type('category', 'post');
  ...
  wp_change_post_object();
}

function wp_change_post_object()
{
  $get_post_type = get_post_type_object('post');
  $labels = $get_post_type->labels;
  $labels->name = 'Articles';
  $labels->singular_name = 'Article';
  $labels->add_new = 'Add Article';
  $labels->add_new_item = 'Add Article';
  $labels->edit_item = 'Edit Article';
  $labels->new_item = 'Articles';
  $labels->view_item = 'View Articles';
  $labels->search_items = 'Search Articles';
  $labels->not_found = 'No Articles found';
  $labels->not_found_in_trash = 'No Articles found in Trash';
  $labels->all_items = 'All Articles';
  $labels->menu_name = 'Articles';
  $labels->name_admin_bar = 'Articles';
  $get_post_type->menu_icon = 'dashicons-welcome-write-blog';
}
```

Note that in `get_post_type_object('post')` the 'post' bit can be replaced with the machine name of whatever content type you want to replace. Umm, if it's anything other than post or page, that would be silly though, as then it would be a custom content type that you could probably edit directly....

以上是关于markdown WordPress将Post文章类型更改为另一个的主要内容,如果未能解决你的问题,请参考以下文章

WordPress将文章更改为文章;

如何将旧的 Wordpress 博客文章 url 重定向到新的

wordpress进阶教程:wordpress文章类型

wordpress调用指定类型post_type的文章

Wordpress 通过 post id 获取文章 url

wordpress调用自定义post_type文章