Add the following custom function in functions.php file of your theme to get the page url without the clean urls
function get_page_custom_link() {
global $post;
$link = '';
if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) )
$link = home_url("https://wordpress.stackexchange.com/");
else
$link = home_url( '?page_id=' . $post->ID );
return $link;
}
And call it in your template as following
<?php echo get_page_custom_link(); ?>
Note : It will not work for other urls( attachments, tags, taxonomy, post etc.)
Related Posts:
- How to set ipv6 address as siteurl?
- Changing www prefix in General Settings and Interior Links
- What does $scheme in site_url function do?
- Override WordPress theme url
- How to Create a Staging Site / Changing URL
- get_template_directory_uri cached?
- WordPress site isn’t reachable after site & home URL modification
- wp_options siteurl and home hardcoded?
- Unable to load WordPress local site after changing WordPress Address (URL) and Site Address (URL)
- can’t access my site [closed]
- Dynamically update Site/WordPress Address
- Does WordPress Strip Away the WWW from a Web Address
- Why is a wordpress login session limited to one domain
- problem with guid, when i change the folder name
- I changed the url from the setting then login panel not working
- Querystring value being stripped from site_url()
- Unable to Update Post when Changing Site URL
- WordPress replaces “https://” with “//” for Site & WordPress-URL
- How to delete blog word from wordpress url?
- Updated Site URL but it is not reflecting the changes
- How to set a home page on a WordPress site?
- Changing siteurl breaks site
- How to add www to images?
- WordPress database nonsense error
- Keeping the URL but changing the site – How?
- change the URL title and tagline
- Is there a way to append a trailing slash to get_home_url() and get_permalink( get_option( ‘page_for_posts’ ) )?
- I changed the site address and wordpress address from localhost to my ip and it doesn’t work anymore
- Relative or dynamic site url possible?
- Rewrite default post type
- How to move existing WordPress wp-content folder along with database to new server and new domain name?
- Difference between bloginfo(‘home’) and home_url() and site_url()
- Site redirects to wrong url when saving settings
- get url page template
- Woocommerce different URL for every table placed in the restaurant
- Sub-domain or 2nd, temporary different domain?
- Changing WordPress blog name and web address
- Concatenate site_url and string doesn’t work
- Modify site URL via functions.php of a theme
- Headless WordPress – Issue with plugin path
- URL parsing – what is it?
- Putting my site live
- Hard code a domain into Yoast SEO canonical URLs
- When clicking on “home” page from any other page, it goes to IP address and my website doesn’t load
- WordPress URL redirect
- Not Found (404) error on admin page, CSS gone on blog
- Pass GET params to URL from a main menu item
- Split Conference WordPress Page in different years
- Moving from http to https, and www. to non-www URL
- How to bulk edit image url in featured image and product description?
- disable site_url redirect in wp-login.php
- Multisite with different domain names on different servers
- WordPress keeps redirecting me to online site [closed]
- new subdomain to apply as main domain
- WordPress: how to change URL for individual MultiSites?
- get_template_directory_uri not dependent on WP_HOME in wp-config.php?
- Permalinks settings
- How to get_template_directory() properly on local environment
- WSOD 3.9.1 – Tried Everything so far
- wordpress url correction
- Include www prefix in site URL
- How do I avoid messing up URLs when switching from example.com/subdir to example.com?
- Two sets of url one content?
- Accidentally changed website url
- Site Address and WordPress Address settings when using a load balancer
- How to make tag pages look as /tags/%tagname%/ in the URL?
- Alternatives to site_url() and get_template_directory_uri()
- What is the best way to revert to www version of domain name?
- How to add a forward slash to the end of wordpress home?
- home_url on IIS missing permalink index.php
- Get logged in username in wordpress url
- URL problem: www.sitename.com/blog and www.sitename.com/learn using same WP installation
- loading images, css and fonts from site url
- Changing siteurl in the database not working
- How to stage a redesigned site on a new webhost while the original site is still live? [closed]
- Add www to the Root Site in WP Multisite Network
- Multisite problem with unexisting paths to CSS etc
- How to rename a wordpress site from http://myserver.example.com/blog to http://myserver.example.com/somethingelse or just http://myserver.example.com
- Deleting /wp from my website URL
- Hide WordPress Site URL from Source Code
- Permalink not changing according to post type
- Domain not redirected correctly with WordPress Multisite
- Landing function through URL
- Update siteurl and home in multisite subsites to https
- change home_url and site_url but don’t redirect to home_url and site_url on load
- Passing taxonomy id of taxonomy clicked on one page to another page
- Referring to site URL in shortcode argument
- How do I get WP site to show in both root and sub-directory
- site_url() returns with additional backslashes
- Removing all my hardcoded URLs with get_site_url()
- Index (Home) page not displayed when running wordpress in a subdirectory
- Displays url’s twice and getting 404 errors after activating
- set cookies for my whole site is not working
- check if .min.css stylesheet exists
- Remove index.php from URL
- ‘Too many redirects’ error after changing site URL in WordPress [closed]
- Advice on WP site structure using multisite
- Siteurl code for links
- How can you change the admin dashboard URL without symlinking?
- WordPress is adding pagination for all pages like www.example.com/page/123. How to remove that?