There really should be a simpler way to do it but you kind of need to know that WordPress stores both the Front Page ID and Blog Page ID in the options table. So, to get the URL of the blog you need to use both get_permalink()
and get_option()
in conjunction.
<a href="https://wordpress.stackexchange.com/questions/270158/<?php echo esc_url( get_permalink( get_option("page_for_posts' ) ) ); ?>' title="<?php echo esc_attr( get_bloginfo( "title' ) ); ?>' rel="home">Blog Page</a>
The above will grab page_for_posts
value from the options table which holds the Page ID of the blog which needs to be set in Settings -> Readings
. By passing an ID to get_permalink()
it will return the string URL that we need for the page.
Related Posts:
- Redirecting to old domain after migration
- Change logo url link
- get_site_url is not returning anything?
- how to make URL link query string
- Renamed my website (URL) – how do I rename all within-page links to the old URL?
- How do I avoid messing up URLs when switching from example.com/subdir to example.com?
- Relative URLs within site
- Image not showing up in media loader success area – followup
- No https in url when writing links like:
- Create 600 links to separate files on google drive
- In-page link works in Firefox but not in Chrome
- Let WordPress to go opening an external URL
- Two domain site: Link base URLs point to wrong domain
- Why am I seeing ‘yes’ and ‘no’ in URLs crawled by Xenu?
- Typing local WordPress URL works, but clicking the same link does not
- WordPress rewrites my link with custom URL scheme to http(s)
- How do you retrieve a post by slug name through REST API?
- How does routing on wordpress work?
- Unwanted media library URLs in posts?
- How to remove file versions from the file source links in wp_head?
- Add menu and submenu in admin with a URL instead of slug?
- Update media file url in wordpress media library
- Change website URL without breaking links or images? WP 3.3
- As soon as I add a custom query_var using the filter, my pages point to an archive page – why?
- how to grab first link in post… and of course call it
- Best way of removing emoji support from url / slug only
- Password protected page Hash url
- Remove site root trailing slash
- Convert link in WordPress 3.2.1
- How to create a page for authors? like www.myblog.com/author/
- Confusion about how a URL is being parsed
- Custom Post type permalink structure with custom_post_id
- Setting a url for a page
- Old URL Redirect website after migration
- Is it necessary to check for `content-type` in headers?
- pass user id in slug and get user information
- What is the correct way to convert the absolute path of the executing script to a URL, in WordPress?
- The requested URL was not found only on localhost
- 404 error when passing “cat” parameter to URL
- Is it possible to configure WordPress’s Core Files to accept duplicate Child Categories?
- Problem with utf8 link
- how to trace a file by the route url
- wordpress.com website url structure [closed]
- Block direct url enter
- How do you make homepage redirect to it’s slashed version?
- HTTP 403 Error when passing parameters to URL
- Get arguments from URL
- How to remove my website link when adding a link?
- Can i have access to my WordPress Website again?
- How to make pages slug have priority over any category
- Site transferred to new server produces 404s
- How can I make my blog urls have words of the title in them?
- Website Address Keep redirect to website after migration attempt
- Change URLs depending on alias
- How to get category/tag in URL for Pagination links?
- Passing values through url for checkbox fields with same name to get?
- Random string added end of the url blog page wordpress [closed]
- Custom HTML title based on URL parameter
- Made WordPress URL and site address URL the same
- How can i get rid of wp in front of URL
- Alternatives to site_url() and get_template_directory_uri()
- Blog post – single.php url
- WordPress File URL Path Incorrect
- Adding more onto an esc_url [closed]
- Unicode characters are saved in a funny way in the DB
- Replace category name with article id in wordpress urls
- Redirect Old wordpress url to new wordpress url
- WordPress Primary Category Changes After Import, Permalink Issue
- Make unique url to unlock a post
- How to set wordpress url on local host to access it via VPN
- unique url access control
- I found weird email address appended to some of my URLs, what does that mean?
- How to get custom URL routes property_id in wp php plugin?
- index.php shows up in url
- Why my WordPress website homepage automatically adding cs_preview=true query parameter to the url?
- how to remove this #.XsZOUWhKjIU from my wordpress url
- Menu links URL with PHP GET method
- Incorrect page shown
- Cannot Save Changes After Updating URL Settings
- Avoiding the -2 in slugs
- How to encode correclty an url with the char “&” for an email?
- How do i create navigation links like this in wordpress? [closed]
- Blog post Links leading to home page [closed]
- Custome home page url
- Why does WordPress convert absolute URLs to relative URLs for menu items?
- Change default query parameters
- Access link page and not folder content of that link
- How do I make images open in a new tab by default?
- problem getting audio url
- Text widget form and URL variables
- wp-login.php ampersand in url results in 404
- How to eliminate the Web Address / Web Link textbox from comment forms
- URL displays different page (a loop)?
- Change path/url of admin-bar.min.css
- Options and template changes not updating
- Why is my WordPress install using full server directory paths for media URLs?
- Accidentally Changed WordPress Url
- 404 error on cyrillic url
- Block a specific url request
- How to create multiple urls for a same page contents in wordpress