If you filter pre_get_shortlink
and return anything but false
WordPress will not create a shortlink with its own logic. If your return value is empty, the shortlink UI will not be printed.
Combining both leads us to:
add_filter( 'pre_get_shortlink', '__return_empty_string' );
If you want to restrict the filter to a specific post type, check the second parameter:
add_filter( 'pre_get_shortlink', function( $false, $post_id ) {
return 'page' === get_post_type( $post_id ) ? '' : $false;
}, 10, 2 );
Related Posts:
- Filter Posts from the Main Query
- Change CPT Edit Target Link for Admin List
- How to enqueue scripts on custom post add/edit pages?
- Row actions for custom post types?
- remove custom post type permalink
- How can I remove the “Add New” button in my custom post type?
- How to change “Draft” string for status of custom post type to “Unavailable”?
- Adding a drag and drop re-ordering from a custom post type default list [closed]
- How do I filter the excerpt metabox description in admin?
- Unregister post type from child theme
- Filter for “get_post_type_archive_link()”
- How to correctly get post type in a the_title filter
- Best way to filter featured image text for a custom post type?
- flush_rewrite_rules on save_post Does Not Work on First Post Save
- WP Admin default view mode for Custom Post Type
- Remove date and category filters when editing custom post types
- With what hook can I address all posts from all custom post types when they are published?
- Make the ‘all’ filter default instead of ‘mine’ in a custom post type
- What hook should be used to programmatically create a post only when master post is updated?
- How to register custom post types in a plugin?
- How to get Custom Post ID by adding filter to child theme’s function
- Can’t unregister parent theme’s CPT from my child theme
- Modifying date filter on admin page for custom post type to link to custom field
- Add html to cpt main page / admin edit.php
- register_taxonomy and register_post_type does not work [closed]
- Why is conditionally loading a custom plugin’s code only on a specific custom post type causing the site content to disappear?
- How to: Display ACF [fields] on Custom Post Types Utilising WordPress ‘Hooks’? [closed]
- Displaying custom taxonomy in the admin list of a custom post type
- Filter term taxonomy metabox in custom post type
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Filter hierarchical custom post type admin page by parent, and include children & grandchildren
- How can I add a filter to a particular post format?
- Is there any way to get list of all possible filter hooks for all post types?
- Create new custom post and post category of same name
- Add a custom text to admin footer in a Custom Post Type page
- Use remove_meta_box conditionally on custom post type
- wp_trash_post action hook with custom post type
- How do I amend form data before it is saved for a custom post type
- sortable columns for multiple custom post types not working
- Catch and display error on save_post action
- How to recover the post ID earlier in the WP admin hook action “firing” sequence?
- Using `set_transient()` when saving a custom post type
- Using publish_{custom-post-type} hook for custom post type to update meta doesn’t work
- Best way to fix bad count on All | Mine | Published
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- Store a value in global scope after init hook is fired
- Dynamic page for nav items used as filters
- Post Click Redirect to Custom URL instead of Single Post Page
- How to store additional data that is related to core data
- Keep br tags from stripping
- Add filter button to custom post type in admin area
- Adding Information To All Posts Screen
- do action inside a class is not working
- Filter Content on all Post Types
- Filter wp_dropdown_categories Per Post Type
- Hook only specific post type
- Create action running on trashed_post hook to modify post_meta value
- How many filter/action hooks are healthy?
- How can I filter posts by post_parent in the admin?
- Is it OK to move admin menu items?
- WordPress Custom Post Type Admin Page really slow
- Filter by custom Field for Custom post type Admin Listing
- Post slug changed using code doesn’t reflect on editor when post is published
- Remove wpautop from all posts/pages except my custom post type
- Taxonomy terms with edit/filter link in wp-admin, in the list of custom posts
- Multiple post types in archives (filter?)
- Want to filter only parent post in admin area
- Filters post in admin with dropdown select, custom post type
- Admin List Dynamic Heading
- Add $more_link_text parameter to the_excerpt()
- Show Custom Post Type values in WordPress grid view
- add filter login_redirect does not contain original requested redirect
- Change headers in admin posts list
- Filter categories of posts with checkboxes
- Namespaced action and filter tags
- Hooking in to an archive page?
- Remove rows in the manage post/page view
- Setting proper query for multiple custom admin filters
- How can I see a list of my Custom Post Types of the last term I was in?
- How to filter wp_list_categories output with some custom post type meta query?
- creat filter with wp_query
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- Custom Meta fields Update hook?
- Include php on a specific page template
- Filter posts by tax (dropdown) and meta value
- Change link for “add new” buttons on custom post type
- How to access page variable inside action hook
- Custom capabilities not reflecting on admin panel
- Display taxonomy with a maximum number of letters
- Change Post Meta via AJAX from the posts list table
- Custom Attachment Type
- Is possible register two archive pages for single custom post type?
- Hook to change the site URL
- In child theme, add CPT to custom taxonomy registered in parent theme
- Save_post – Warning: Cannot modify header information
- Correct way to register custom post type from external php file?
- How to redirect from wp-admin/edit.php to a frontend page for specific custom post type?
- Custom post meta box as a sub form
- Customizing a plugin function using a hook
- How to change wp-admin and wp-login urls