Add that to your functions.php:
function wp_link_query_mod ( $results ){
if( count( $results ) ){
for( $i=0; $i<count($results); $i++ ){
$results[$i]['permalink'] = wp_get_shortlink( $results[$i]['ID'] );
}
}
return $results;
}
add_filter('wp_link_query', 'wp_link_query_mod');
This hook is only usable since WP 3.7, if you have an earlier version then there is an alternative but it would mean changing a line in WP core files.
Related Posts:
- How to get a page url by a page id?
- Get the url of a page template without using the page slug and ID
- Edit permalink for certain pages
- cannot link a external url, present page url acting as parent url
- How to use page jumps to top of banner and page title?
- How can I see a list of all pages my WordPress site has generated?
- My WP homepage works, but the other pages don’t when accessing from out side of my network
- Can I link to content dynamically from a page to a new page?
- Is it possible to get a page link from its slug?
- How can I reverse engineer a Permalink to Find the Page?
- How to use relative links on my pages?
- Page begins with number, WordPress adds 2
- Removing hierarchical pages in the permalink
- Can WordPress realistically handle a site with 500 ‘pages’?
- Subdomains to pages
- Passing variables through permalink structure
- Broken wordpress permalinks on pages only
- Why does WP not use relative links when linking pages?
- Menu Link Redirect Based on Username or User ID
- Social Media Links on homepage – within posts/post loop
- Change website URL without breaking links or images? WP 3.3
- Relative or Absolute Paths for Flash Video Player Files
- Should I use relative or absolute urls when pointing to internal pages
- How to change the permalink structure of a master page?
- Why I can’t change the permalink of this page?
- Redirect user if it’s not logged in
- Page Attachment Permalink Structure based on Menu Order?
- I copied my site to another site but all links point to old site
- Best way to add internal link in widget
- Confusion about how a URL is being parsed
- How can I add a page’s ID to its permalink using WP_Rewrite?
- Permalinks for pages
- Permalinks by page/post name returning 404
- why some permalinks adding characters/ruining links
- Pages not using permalink
- How to get post object on blog template
- Is it possible for a custom post type and sub pages of a page with the same slug as the custom post type to share a slug?
- Add prefix to page URL based on the page template
- Migrated from Windows to Linux. Any bulk methods for fixing case sensitivity?
- get_permalink returning site home url instead of the url of slug being passed
- How to eliminate permalink prefix in WordPress Multisite
- Remove -2 from URL; no duplicate pages, no images, no pages in trash
- How to handle broken links created by permalink/slug changes?
- Host frontpage via example.com and everything else via example.com/blog
- How to generate a list of all urls
- WordPress is suppressing page extensions!
- Let me choose permalinks
- Passing the JQuery string to Worldpress URL
- Path to Pages Resolves to Archive instead of Actual Content
- Changing permalink name redirects to another template?
- How do I reclaim either deleted pages or their permalinks?
- Format HTTP links
- Permalink of a page that has already been deleted
- Test site pages go to main site
- “-2” Being added to end of URL (no duplicate pages, no pages in trash)
- Redirect From Url To Url
- Moved site, Old links in pages still pointing to old host
- How to remove the link of an image on WP 4.2
- Get a link to paged() part?
- WordPress Page Not Found if Permalink Settings is Postname
- Pagination url for page template
- Why does enabling Permalinks make pages not found?
- Create custom links for excerpts with php dynamically
- Page content doesn’t display when published but does when previewed as draft?
- How to link post titles on page A to its posts on page B?
- WP as a CMS menu
- Subdomains pointing to a permalink URL
- Auto Changing Text Case
- Default Permalink Structure for Pages
- Non Latin page permalink problem
- How to make different urls for some tags pages
- How do I structure my permalinks in WordPress?
- A dash can replace a period in a link, how to fix it
- Link to a page before launch
- Nested permalink without dummy parent page
- Custom Permalink (with category) for Pages
- Woocommerce product page 404 not found
- Propper way to set anchor and url param
- Find internal links to post
- Remove link function from oembed image or video
- Page returns 404 for specific permalink
- The permalink for the page doesn’t work and page’s defined link throws “Object not found!”
- How to change dynamic link to relevant post
- Difference and usage of uri (e.g. get_directory_uri) and absolute path (e.g. get_directory)
- Page permalink ending in “-2”
- Change the permalinks structure
- Development before domain name chosen
- Possible to hide parts of the slug from get_template_directory_uri and bloginfo(‘template_directory’)
- After changing permalink settings, everything works fine except for the two most recent posts
- Select page/template from the permalink url
- Latin character conversion
- Permalink for pages
- Pretty links for PHP pages above WP /blog directory?
- Permalink / sub-template issue
- Mystery ghost page not appearing in Admin
- Category pagination first link works, remaining don’t
- What is the issue with our links? It creates a loop
- wp_get_attachment_url not working
- Permalinks of New Pages and their Parents
- Make all internal links relative, or otherwise make a website accessible from multiple domains