I think you’re only adding the custom posts to the nav menu on the front-end and not on the back-end/wp-admin.
Therefore, you can use is_admin()
to see if the hook wp_get_nav_menu_items
is being called on the front-end or from an “admin” page such as the Appearance → Menus page.
So, replace this:
function services_menu_filter( $items, $menu, $args ) {
/* alter the URL for cpt-archive objects */
..with this one:
function services_menu_filter( $items, $menu, $args ) {
if ( is_admin() ) {
return $items;
}
/* alter the URL for cpt-archive objects */
Alternatively, replace this:
add_filter( 'wp_get_nav_menu_items', 'services_menu_filter', 12, 3 );
..with this one:
if ( ! is_admin() ) {
add_filter( 'wp_get_nav_menu_items', 'services_menu_filter', 12, 3 );
}
Related Posts:
- WordPress Custom Post Types with a page as a parent?
- wp_get_nav_menu_items wp-admin/customize.php problem
- What does this PHP function code mean? [closed]
- How to create a custom search for custom post type?
- what is the correct way to compare dates in a WP query_posts meta_query
- How do you use a CPT as the default home page?
- Can a custom post type have a Parent Page?
- Restrict custom post type to only site administrator role
- Creating an Image-Centric Custom Post Type?
- don’t publish custom post type post if a meta data field isn’t valid
- Correctly delete posts with meta and attachments [duplicate]
- How do I append multiple taxonomies to the URL?
- Why are the comments disabled by default on my custom_post_types?
- Linking Two Post Types
- Prevent pre_get_posts filter on specific post type
- How to force one column layout on custom post type edit page?
- How to set a default format for a custom post type?
- Multiple post types – share same ReWrite slug?
- Remove current_page_parent nav class from blog index when in CPT
- Custom Post Types on Category Pages
- Setting Default Category for Custom Post Type Upon Autosave
- Creating “static” taxonomies to choose from, inside custom post type?
- How to change “Draft” string for status of custom post type to “Unavailable”?
- Search multiple custom fields by using meta_query
- Custom post status not working
- How to order adjacent posts (prev / next) by custom field value?
- How do I filter the excerpt metabox description in admin?
- How to model a hierarchy for courses, levels and lessons?
- Setting up custom post type archives in WP3.1? Any luck?
- How to Remove Certain Screen Options and Table Columns from post type in wp_list_table?
- Custom Taxonomy with Custom Post Type Finds No Posts
- Best Way to Create a List of Musician Gigs in WordPress
- Get custom post type by category in a page template
- How does one delete orphan custom post type?
- Associating an “author” with a custom taxonomy
- How make get_next_post() return first post when viewing last one
- Redirect after deleting post and keep track of pagination
- WP 3.1 – archive pages for custom content types possible now without a plugin?
- Admin Post Update Redirection to Posts Screen
- add_rewrite_rule and custom variable
- modify all posts of a category to “no comments allowed”
- TV Show database – Best way for structuring it?
- Add custom field to media attachment image attribute in post editor
- Problem excluding category from get_next_post
- Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
- How to not allow custom roles to edit published custom post types?
- Delete all the custom post types when deleting user
- Localization For Two Different Regions/Domains with the Same Language
- Correct way to use a form to to filter custom posts by taxonomy terms?
- Assign Page Template Within A Custom Post Type
- Showing current taxonomy terms
- Add comments meta fields to comments metabox on post edit screen
- Removing Image Sizes for Custom Post Type
- specify meta_key / meta_value condition for prev_post_link and next_post_link
- White screen error for a custom theme
- How to override parent theme function through the child theme [closed]
- Custom Post Type with Custom Title
- automatically create taxonomy with same name as post title
- How to add a select menu to this metabox code?
- Query posts by custom post type and custom taxonomy
- How can I remove categories in menu in custom post type?
- Custom Taxonomy conditionals
- Nav menu of all posts in a custom post type
- remove_action conditionally for Custom Post Type
- Search results ordered by custom post types are not grouped
- Single Page WordPress CSS and JS links
- How can I customize “Pages” admin (edit.php) and “Edit Page” admin (post.php) for bulk edit of custom content type?
- Assigning a role to a specific custom post type (and ignoring other post types)
- Display posts in random post types
- Full-Ajax Theme: parseJSON error while building a JSON object from a WordPress custom template
- Custom Post Type by user
- saving custom post type data to different table in wordpress
- Query post types with multiple keys
- posts_nav_link on single post template
- Having trouble with custom post type / meta box
- Interesting Custom Post Type Slug with Taxonomy and Custom Field
- Dropdown list of a custom post type
- Highlight nav menu terms
- [Plugin: Posts 2 Posts] Changing display order of connections
- Remove POST_TYPE from custom post type permalink
- same archive template for different custom post
- Custom Taxonomy Breadcrumb Navigation
- Disable dragging of metaboxes in custom post types?
- Custom Post Type post ordering not working
- Error after deleting Custom Post Type with a function (no trash used)
- Restrict categories to a custom post type
- Post Ancestor and Child Post in Custom Post Type
- How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”
- After deleting a post are terms, and custom meta deleted?
- Get all posts WHERE custom_field is LIKE value
- Storing Custom Post Type Data in a Custom Table
- Get the post children count of a post
- How do you output custom code between posts in the loop?
- How to delete all posts from a custom post type?
- Select menu should display categories and the item’s depth
- Best practice for adding posts in bulk
- Structure for projects and clients
- Why are navigation items saved in the database?
- Should I use Custom Post Types or something else
- adding .current* tags to custom post types and taxonomies