From your question:
I’ve tried it both with and without the
esc_url
wrapper, but either
way, it ends up moving the existingpage
query arg to the end, and
prepending it with#038;
instead of the ampersand.
And from your answer:
The root cause was determined to be that
menu_page_url
runs through
esc_url
even whendisplay
is set tofalse
So yes, that’s correct, and you could alternatively manually construct the URL like so: admin_url( 'edit.php?post_type=cwr_ticket_page&page=cwr-tickets' )
.
But as for this:
how to (properly / the WordPress way) construct this CPT admin submenu URL for the links
Since you’re linking to the same page, then just use add_query_arg( $args )
:
$link = '<a href="' . esc_url( add_query_arg( $args ) ) . '">View</a>';
Because add_query_arg()
will default to using the current URL.
Related Posts:
- Redirect after deleting post and keep track of pagination
- Row actions not showing? Why?
- How do I alter the position of a Custom Post Type menu item within my plugin admin menu?
- Add Custom Post type menu to another menu in specific location
- How to group navigation items in the admin panel
- How to select meta key in custom database query
- Issue removing columns from admin table
- WP_List_Table Inside Metabox Not Working on Clicking Search Button
- How to avoid hardcoded text in a custom page template?
- Custom Taxonomy Showing in WP Menu
- No posts found – Custom Post Type show_ui
- How to customize a permalink (URL) structure?
- Adding a custom post type taxonomy template in plugin
- Plugin: register custom post types, child ready and performance best practices
- How to add a custom taxonomy to show up in a custom post type menu?
- With two custom post types, how to make one a child of the other in the admin menu?
- Default sort on admin columns with meta date hides draft posts with empty date value
- Give a permalink to Custom Post Types without title
- Getting template_include to work when allow_url_include is off?
- Custom post types as sub menu pages and role capabilities issue
- WordPress post_where & posts_join not working only for custom post type
- Add custom ID to CPT posts only create not update
- Add custom post type as submenu [closed]
- WordPress multiple custom post types capability conflict in a single menu
- Getting meta in editor plugin, and event triggering issue
- Orderby CPT custom fields not working
- Unable to get Custom Plugin Options data
- Update post meta not working in transition_post_status
- Use custom metabox to update automatically a post after a given date
- Addition of custom option panel crashes Media Library & Admin Area
- How to display Custom Taxonomy under Custom Admin Menu?
- Able to edit custom post, but unable to create new custom post when within submenu. What capability is missing?
- Add Custom Post Type as top level menu item for a custom page
- Custom Permalink to remove category word , keeping posts permalink with date?
- Possibilities for the edit.php admin panel? [closed]
- Form action/link to render a plugin in WordPress front-end
- What is the best practice for displaying my plugin content in themes?
- Show post in table front end
- Custom post type archive page blank
- Set a CPT slug as a base name for all the taxonomies
- How to use TinyMCE Editor for one of my custom post meta field?
- How to Create a WordPress Plugin With Custom Post Type/Custom Field Features?
- How to remove post listing page for a custom post type
- Custom post listing page layout of custom post type
- How to Get WordPress custom post data in WooCommerce product meta panel? [closed]
- Add custom column to post list table
- A custom post type in another post type
- Adding a metabox on a CPT’s submenu page
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- 2 Different Custom Post Types in Submenu
- Plugin fatal error
- custom comments form for custom post type
- Wrap meta boxes & data handling for specific post types in classes?
- Problems wp_insert_post and save_posts filter
- Custom fields for custom post type
- How to sort posts in a custom post type by title in ascending order by default?
- Suggestion on custom post type/ taxonomy relationship
- wordpress remove views from action links in a custom post
- When should I create custom post types?
- Custom post type’s extra fields – how to handle?
- Ordering Submenu Pages in WP 3.1
- Save Multiple Metabox values
- Send a conditional email notification when a custom field value changes in Post Type
- WordPress custom post type capabilities issue
- HowTo: Custom Post Type (Meta) to Custom Table
- how to set a WP Plugin’s url
- Getting 400 Bad Request on AJAX Call
- Main query not querying any posts in custom taxonomy template
- Custom Empty Results page for my Custom Post Type
- detect your custom post type in WordPress
- ACF in wordpress
- Programatically inserted posts not showing in Posts Table
- Theme independent plugin by using default page template
- Option page’s form doesn’t work
- How to add and clear custom post types and taxonomies in a plugin? Considerations for existing data
- post_parent in custom post type
- What’s an efficient way to change the post status of many posts at once?
- Conflict between Capabilities and Menu Visibility with Custom Post Types
- How can I include active content in a custom post type?
- Dynamically insert code to custom post type loop
- Show current custom taxonomy
- sortable columns for multiple custom post types not working
- How to insert data into meta box from another plugin?
- How exclude or skip post type with get_next_post_link
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- How to access the thank you page from the single post?
- How do I add custom HTML to the content of an archive page’s posts?
- How do you make a list and list item relation if custom post types?
- Add to ‘action’ within post.php to allow more actions when editing a Custom Post Type in a plugin
- ajax response not recieving
- Getting post attchment URL to populate a CPT Admin Page Column
- Add form after woocommerce admin order edit
- Using menu_position to add two entries between Dashboard and Posts
- Custom Meta Box returns no HTML
- Unable to format dates to put in event calendar
- How to Use Custom Meta Field Instead of CPT Title in Post URL
- Dynamic assign a custom template to custom post type posts
- How to add and display custom content that is not a post
- Reusable metabox backend and frontend
- Custom post type in Custom widget – $listItem