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
- Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin?
- Custom Post Type Plugin: Where Do I Put The Template?
- Meta Boxes: ‘admin_init’ or ‘add_meta_boxes’ hook?
- Creating a Custom Post Type as a Plugin? Why?
- Can I have Post Types under other Post Types in Admin menu?
- Add Post type menu to another menu
- How do I create multiple post types in same menu section in WP-admin?
- Is flush_rewrite_rules necessary when creating a custom post type? Why?
- Unable to filter on field on edit.php page
- Custom Taxonomy and tax_query Issue?
- template_redirect not working, apparently for no reason
- Custom role capabilities to administrator not taking effect (no plugin)
- How to use custom post type APIs, but use a different db table
- Hierarchical or Non-hierarchical Custom Post Type in Real World Example
- How to append element after thumbnail
- How to add new tab to admin list of posts and handle result list
- handling csv data with a custom post type
- Trying to add script to specific admin page is not working
- Custom Post Type rewrite
- Admin notice not displaying
- Detect where custom post type is declared
- Insert Multiple Post with Same Publish Button
- Move custom post menu to under plugin admin menu
- get_object_taxonomies() returns empty array for custom post type
- Adding a custom post type taxonomy template in plugin
- Plugin: register custom post types, child ready and performance best practices
- Add custom ID to CPT posts only create not update
- Add custom post type as submenu [closed]
- Getting meta in editor plugin, and event triggering issue
- Unable to get Custom Plugin Options data
- Able to edit custom post, but unable to create new custom post when within submenu. What capability is missing?
- Possibilities for the edit.php admin panel? [closed]
- What is the best practice for displaying my plugin content in themes?
- How to use TinyMCE Editor for one of my custom post meta field?
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- custom comments form for custom post type
- Custom fields for custom post type
- How to sort posts in a custom post type by title in ascending order by default?
- When should I create custom post types?
- Custom post type’s extra fields – how to handle?
- Save Multiple Metabox values
- Main query not querying any posts in custom taxonomy template
- 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
- Show current custom taxonomy
- How to insert data into meta box from another plugin?
- How exclude or skip post type with get_next_post_link
- Getting post attchment URL to populate a CPT Admin Page Column
- Using menu_position to add two entries between Dashboard and Posts
- How to add and display custom content that is not a post
- Odd behaviour for the update button when displaying a WP_List_Table
- Problem with adding custom post type meta to header by plugin
- Types plugin custom post add_action hooks
- How to create a master without relying on posts table
- Limiting Amount of Posts in a Custom Post Type again
- Not Able to Add New Class To CPT Attachment Image
- Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value
- Orderby custom fields is not working
- Why are custom taxonomies only appearing on the edit page of one of these types, but not the other?
- How to stop the custom post type URL from the google search?
- URL issue retrieving Custom Post Types using Backbone JS API
- WordPress Custom Post Loop
- Changing CPT permalink
- Get all posts by many custom post types
- ‘Simple’ Reservation System
- Warning , Use of undefined constant PLUGIN_PATH?
- Show Post columns to specific users on condition
- Error when moving custom post type to bin
- Admin metabox with custom post type dropdown option not update choosed input after saving
- Having issue on Loading Meta Data From CSV to CPT
- custom data model – link and populate from admin backend
- Custom Post type plugin is using theme single.php and style.css
- php output of generated custom metabox
- call a function when insert and update a custom post type
- Can’t save custom post type fields
- Duplicate “Pages” Item in Admin Menu
- Registering an optional custom post type from a plugin
- Shortcode error
- Generate custom RSS from a plugin
- Get term_id for each instance of custom taxonomy
- How to internationalize the sub menu name “categories” in Custom post type?
- Creating a Custom Post Type as a Plugin? Why?
- Add top-level menu pointing to a different custom post type?
- Separating a custom taxonomy from blog post-type
- WordPress Roles
- Custom post types not showing in the admin menu on production, but shows locally
- Menu Structure and URL structure, with Pages and Post-Type-Posts
- Custom Post Type urls not working
- Admin menu link with variable
- I want to show a list of post with title that have link goes to that post and icon under the specific category to which it belongs