When one creates a custom post type you have the ability to define various elements related to that post type which essentially allow you to define things such as the menu title, “add new post” text and stuff like that.
What I am trying to figure out is what code I need to add to my functions.php file so I can set these things for an existing “default” post type which wordpress adds.
So, for example lets say I want to change the “Pages” post type to “Main Sections”.
Currently what I have done is used the following code:
add_filter( 'gettext', 'change_admin_menu_pages' );
add_filter( 'ngettext', 'change_admin_menu_pages' );
function change_admin_menu_pages( $translated ) {
$translated = str_replace( 'Page', 'Core Page', $translated );
$translated = str_replace( 'page', 'core page', $translated );
return $translated;
}
Although this works and just replaces every instance of “pages” with “main sections”, what I have noticed is that it also effects other areas of the site such as plugins which use “pages=” within their url.
As such… is there a simple way to define post type settings for default wordpress post types like “pages” and “posts”? If so, could someone please quickly illustrate how that might work?
On a different note… I feel that using the filter
- add_filter( ‘ngettext’,…)
is actually very useful but what I don’t understand is how to restrict the area where its allowed to filter things.
An answer to both or either question would be greatly appreciated
Thanks in advance!