You can use “get_page_link” function to Retrieves the permalink for the current page (if in The Loop) or any arbitrary page ID if passed as the first argument.
something like this:
<a href="https://wordpress.stackexchange.com/questions/219011/<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a>
Reference: https://codex.wordpress.org/Function_Reference/get_page_link
Related Posts:
- Drop down+sort blog posts date added/most popular
- Save selected item from dropdown menu in a meta box as a metadata value for a custom post type
- How do I create a drop down menu in a widget?
- Second select list values are not saved after clicking update
- Replacing the NavWalker dropdown element
- Select dropdown not showing selected value php
- Archive dropdown styling not applied
- Getting the dropdown menu to redirect to different pages?
- How to make drop down post title
- Filter Select results based on selection
- How to pick the default selected value in wordpress dropdown?
- how to save selected option in variable for rest api category filter
- Display parent and child taxonomies in separate drop down select fields
- wp_dropdown_pages auto submit
- Isotope Drop Down Categories Filter Function
- HTML dropdown setting not showing last saved value in the database
- Sorting dynamic select/dropdown for Contact Form 7 of Modern Tribe Events posts
- How to use wp_nav_menu to create custom dropdown menu?
- Save the value of a wp_dropdown_pages
- Custom Taxonomy Select Menu: Setting default option value?
- go to home page when i select default in select-box
- How to set value selected using select2 jquery plugin
- Dropdown category field inside repeatable metabox
- How to make a pagination with dropdown selection?
- PHP drop down menu for my get_category child of
- custom field meta-box with dropdown/autocomplete
- Page 2+ of taxonomy archives does not recognise sort-order from dropdown
- Save data of select list after clicking save
- Dropdown Menu for Query_Posts
- Open WordPress Page from selected option dropdown
- Contact form with dynamic dropdown and filter
- How to use nonce with front end submission form?
- Autoloading in Child Theme
- WSOD but WP_DEBUG not giving any errors
- How to loop through JSON data in wordpress WP REST API
- Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- WordPress Customizer: How can you have multiple active callbacks on one control?
- Looking for a better way to handle an ajax script that pulls in post data on click
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- Adding featured image via PHP
- wordpress custom endpoint multiple params
- Enable errors PHP WordPress 5.2
- How to set status codes such as 401 and 403?
- Minify HTML, CSS, JS with PHPWee?
- Show Custom Taxonomy Title
- How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)
- WordPress widget/sidebar dividers?
- Add custom php database code above
- Help with some php math in WordPress
- max_input_vars: how many am I using?
- Multiple WordPress Menus that will only display all pages
- Latest post in a specific menu
- WordPress not reflecting changed of the database
- Woocommerce related product text
- WordPress, AJAX and pre_get_posts using conditional tags
- Font Awesome changing default WordPress Font
- Help with a $wpdb MySQL Query
- a:0:{} is replaced into database as s:6:”a:0:{}”;
- Echo a function inside a function
- Download full html page with CSV export plugin
- wp_force_remove_style’ not found
- Is it bad to add html to a widget by closing and reopening the php tags?
- how to disabled a button when press three times
- how to save checkbox data for custom setting?
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- Is it possible to change content in my PHP file from WordPress dashboard
- Enqueing External JS on the remote server JS
- My jQuery Ajax form submit is still refreshing page?
- Restrict characters in comment section
- Required PHP version: 5.3.3 – Version found: 5.2.17… How or where do upgrade to 5.33 [closed]
- Remove submenu item from list
- Customize field names in backend profile edit page through function.php [duplicate]
- Trying to change featured image from 180×180 to full width on home page
- How to exclude labels from certain categories in a shortcode?
- Hot to check if new posts have been published since page load and notify online users?
- How does add_option() function enable action hooks to fire right after actiavtion?
- Change permalink structure specific category
- How to pass username in affiliate link in wordpress website
- How can I update WordPress plugins or WordPress itself in all server?
- WooCommerce Query Product Titles
- Unable to display multiple parameters from url by javascript through shortcodes
- Run a sql (update) after 12 hours after the user login. Woocommerce users
- Wp_Schedule_Event every few minutes doesn’t work
- Notify the user by e-mail after the creation of a post
- Rewrite rule for wp
- add php code within html in wordpress
- Implement jQuery Smart wizard
- How to center all text body in single.php at once?
- AMP version of e-commerce without plugin
- WP Redirect with user nickname/username
- If else statement based on referral URL
- Archive page if else not working for post_excerpt and post_content
- Hide sharing box and author box with a metabox on WordPress
- WordPress Website Featured Image Replacement Issue
- syntax error unexpected ‘}’ at 364 line
- 500 error when using wp_upload_dir() [closed]
- Using Excel formula in PHP. Use ^ symbol [closed]
- PHP warning Invalid argument supplied for foreach() on custom page template
- Assign new post author IF another user in custom field on post transition