WordPress Link Functions

Beginner
6 min read
Updated: Nov 2026
25 function guides
Function index

About This Index

This page is the WordPress Link Functions index. Each row links to a full guide with syntax, three examples, and FAQs.

Learn the big picture on WordPress Link Functions. Use this page when you need one function, such as the_permalink(), home_url(), or edit_post_link().

Remember.

Functions that start with the_ print a value. Functions that start with get_ return it, so escape it with esc_url() when you print it. home_url() is the front of your site, and site_url() is where WordPress is installed.

How to Call a Link Function

Most link functions are used in theme templates. Here is one that prints and one that returns.

WordPress
<?php
// Prints the URL (already escaped).
?>
<a href="<?php the_permalink(); ?>">Read more</a>

<?php
// Returns the URL. Escape it when you print it.
$url = get_permalink();
echo '<a href="' . esc_url( $url ) . '">Read more</a>';

WordPress Link Functions Table

All function guides in this WordPress links series (25 tutorials). Start with the_permalink() and home_url().

Site & Home URLs

6 functions

Build links to your front page, your WordPress install, and wp-admin.

FunctionDescriptionTutorial
home_url()Return the home URL of the current site, with an optional path.Read guide
get_home_url()Return the home URL of a site, with an optional path. Can pick a site on multisite.Read guide
site_url()Return the site URL of the current site (where WordPress is installed), with an optional path.Read guide
get_site_url()Return the site URL (where WordPress is installed) for a site, with an optional path.Read guide
get_admin_url()Return the admin area URL for a site, with an optional path.Read guide
user_trailingslashit()Add or remove the trailing slash of a URL to match your permalink setting.Read guide

Search, Feeds & Privacy

5 functions

Search result links, feed links, and the Privacy Policy link.

FunctionDescriptionTutorial
get_search_link()Return the URL of the search results page for a search term.Read guide
get_search_query()Return the current search word, escaped by default.Read guide
the_feed_link()Print a link to a site feed (RSS or Atom) with the text you choose.Read guide
the_privacy_policy_link()Print the Privacy Policy link, if a policy page is set.Read guide
get_the_privacy_policy_link()Return the Privacy Policy link as HTML, or an empty string if none is set.Read guide

Frequently Asked Questions

They are functions that print or return URLs and links: permalinks, the home and site URL, search links, feed links, the privacy policy link, edit links, and shortlinks.
the_permalink() prints the URL. get_permalink() returns it, so you can store it or build your own HTML. Remember: the_ prints, get_ returns.
home_url() is the address of your front page. site_url() is where WordPress is installed. They are the same on most sites, but can differ when WordPress lives in a subfolder.
Edit links such as edit_post_link() show only to logged-in users who can edit that item. Visitors see nothing.
Yes. When you print a URL that a function returned, wrap it with esc_url(). Functions that print, such as the_permalink(), already escape it.
Start with the_permalink() and get_permalink(), then home_url(). Learn the edit links next.

Start with the_permalink()

Print the permalink of the current post, already escaped.

the_permalink() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful