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
- Restrict custom post type to only site administrator role
- Prevent pre_get_posts filter on specific post type
- How to force one column layout on custom post type edit page?
- Multiple post types – share same ReWrite slug?
- How to change “Draft” string for status of custom post type to “Unavailable”?
- Search multiple custom fields by using meta_query
- How to Remove Certain Screen Options and Table Columns from post type in wp_list_table?
- How does one delete orphan custom post type?
- Redirect after deleting post and keep track of pagination
- Localization For Two Different Regions/Domains with the Same Language
- Add comments meta fields to comments metabox on post edit screen
- Custom Post Type with Custom Title
- remove_action conditionally for Custom Post Type
- 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
- Custom Post Type by user
- posts_nav_link on single post template
- Interesting Custom Post Type Slug with Taxonomy and Custom Field
- Custom Post Type post ordering not working
- How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”
- How do you output custom code between posts in the loop?
- Best practice for adding posts in bulk
- WP 3.1 getting tax_query to work in query_posts()
- How to get Custom Post ID by adding filter to child theme’s function
- Impossible to get Attachments Outside WordPress?
- Remove All, Published and Trashed Post Views in Custom Post Type
- Assigning the same custom meta box to multiple post types
- WordPress if in term*
- Weird problem happening with custom taxonmy when creating/updating posts
- CPT: if more than X images are in post, use pagination
- Conditional Query of Custom Post Type and custom taxonomy
- Meta query for custom post type ignored in main query
- How do I move/order posts with a tag to the end?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- Custom Path/Folder behind a custom post type
- Structure of data : CPT + terms
- Default text in a specific post type, but not visible?
- WP_Query custom post type query not showing the exact post type
- How To Show All Custom Post Types In A Category Instead Of Pagination?
- How to remove post listing page for a custom post type
- How to include term custom meta into the custom taxonomy term permalink structure
- How do i search authors from search form using author’s name
- Ordering Submenu Pages in WP 3.1
- How to customize work area / admin area in a custom post type without plugins?
- Change “empty trash” button text?
- How to display custom field value on page?
- Move Genesis Single Page/Single Post Title
- why post_class() function apply css classes to all other files?
- Custom post type’s posts are not showing anywere but in xml sitemap
- How to Create a Separate Page for Blog Posts in WordPress
- Add custom columns in custom post type browse page
- Create custom WP_List_Table in post_type
- How to hide a custom field from admin?
- Get terms for a specfic post from multiple taxonomies in custom post type
- CMB select with data from CPT
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- how to use custom post types collectively integrated with each other
- Why doesnt my tag page populate with this custom post type?
- Problem with customize page cached in WordPress.com [closed]
- Multiple categories assigned to a single product breaking the breadcrumb
- How to get next post link of child custom post type from parent post and get next post link of parent post from the last child post?
- Adding a location field to buddypress activity
- Create API’s for custom-post types & custom queries using REST or Graphql
- custom post type and user post count shortcode
- How can I assign multiple parents to CPT?
- Getting 404 on child page with pre_get_posts() on custom posts
- CPT: multiple loops with different terms
- Stored meta from attachment, video length?
- Limit posts per page depending on the size of a div?
- Delete Post by User
- save_post affect creation and deletion
- wp_nav_menu doesn’t seem to work on custom post type pages
- Set a static page as a user profile page?
- Problem to get the link of the default ‘post’ post type like the orther custom types
- WordPress query posts by custom post type not workng
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- How to keep a CPT stick to specific position?
- WP_Query for CPT with filter by another WP_Query
- Get data from custom post type to another custom post type?
- Using get_terms() as shortcode attribute
- Turn post into simple slideshow
- Problems with a custom meta_box
- Multiple Block Quotes without using HTML
- How to apply order on custom taxonomy and custom meta key on custom post type
- How can i display on front page a movie that is atached in a post type
- Data won’t save on a straightforward metabox, what am I missing?
- Custom post type functions.php if statement on action
- Query multiple post of which one by taxonomy
- How to make a template for a specific post of a custom post type?
- Bulk update custom post types
- Set a Custom Post Type as a Homepage
- Slideshow/Gallery plugin based on WP Core Gallery [closed]
- How to create a job post by email parsing? [closed]
- ACF select box css color change
- Creating post custom field text area
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working
- is therer any wordpress function to retrieve a specific html element from post content