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
- Switching MultiSite installation from HTTP to HTTPS
- Getting the Site URL Including the Front Base
- Relative or dynamic site url possible?
- Difference between bloginfo(‘home’) and home_url() and site_url()
- Run WordPress frontend and backend in different domains
- (How) Can I change my Multisite Network to use a different blog as Primary?
- get url page template
- Woocommerce different URL for every table placed in the restaurant
- Do I need to use the esc_html() function on hard coded links?
- Changing WordPress blog name and web address
- Redirect main domain to subdirectory
- Getting links to work the same on development and production
- Modify site URL via functions.php of a theme
- Headless WordPress – Issue with plugin path
- URL parsing – what is it?
- 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
- Pass GET params to URL from a main menu item
- What do the schemes login, login_post, admin, and relative mean?
- How do I retain url parameters the entire time a user browses my site?
- WordPress Multi-Site on Ubuntu 18.04 LAMP Keeps Re-Directing
- How to bulk edit image url in featured image and product description?
- Multisite with different domain names on different servers
- WordPress keeps redirecting me to online site [closed]
- How to achieve my custom post url structure?
- WordPress: how to change URL for individual MultiSites?
- get_template_directory_uri not dependent on WP_HOME in wp-config.php?
- Get the URL of the page from which an ajax request has been launched within ajax callback
- How do I get the site url from a Block (within the block editor)
- WordPress get parameter ‘unapproved’ and ‘moderation-hash’
- Changing the website URL to the root folder
- WSOD 3.9.1 – Tried Everything so far
- Changing the color scheme based on the url visited
- wordpress url correction
- How to return site_url() without https://
- Include www prefix in site URL
- How to Use Custom Meta Field Instead of CPT Title in Post URL
- Replace “http://localhost:8888/” by website URL in WordPress
- dynamic site link for future migration in echo do_shortcode()
- Cannot access WordPress website from external IP while internally it is working properly [closed]
- How to make tag pages look as /tags/%tagname%/ in the URL?
- Proper way to have multiple installs with a single database
- What is the best way to revert to www version of domain name?
- Abnormal activity at url /my-account/add-payment-method/
- How to make a seo friendly URL of 2 different pages with same words
- How to access wordpress from domainB which is installed at domainA
- WordPress is adding “category” word before my actual category name in url (and this is unsolicited)
- Add www to the Root Site in WP Multisite Network
- WP returns to domain root instead of siteurl
- 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
- SSL not working fine, Home url not matching with site url wordpress errors
- Hide WordPress Site URL from Source Code
- Permalink not changing according to post type
- There is how to change url domain on some posts?
- Landing function through URL
- change home_url and site_url but don’t redirect to home_url and site_url on load
- Homepage cannot be found
- Unable to get WordPress’s apply_filters(‘site_url’) to return a https scheme
- Blog broken after changing Site/Home URL
- site_url() returns with additional backslashes
- Moving Site: Is Re-downloading Files After Changing URLs necessary?
- Two domain site: Link base URLs point to wrong domain
- How to retrive previous Domain URL in Wp
- set cookies for my whole site is not working
- Making a site URL
- Remove index.php from URL
- Siteurl code for links
- Can’t change url because site address is greyed out
- Redirect all URLs in WordPress and Permalink to by country to subdomain
- prevent wordpress from changing/rewriting url ip with the siteurl settings