{"id":34579,"date":"2010-06-28T21:28:57","date_gmt":"2010-06-29T01:28:57","guid":{"rendered":"http:\/\/wpmu.org\/?p=34579"},"modified":"2012-10-08T23:22:28","modified_gmt":"2012-10-09T03:22:28","slug":"daily-tip-wordpress-3-0-new-template-tags-for-home-and-admin-urls","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/daily-tip-wordpress-3-0-new-template-tags-for-home-and-admin-urls\/","title":{"rendered":"WordPress 3.0 New Template Tags for Home and Admin URLs"},"content":{"rendered":"<p>I love when template tags get shorter, don&#8217;t you?<\/p>\n<p>Whereas previously we might use <b>bloginfo(&#8216;url&#8217;)<\/b> or <b>get_option(&#8216;site_url&#8217;)<\/b>, WordPress 3.0 has some new template tags:<\/p>\n<p>The new <b>home_url<\/b> template tag retrieves the home url for the current site. Here&#8217;s the default way to use it:<\/p>\n<p><code>&lt;?php home_url(); ?&gt;<\/code><\/p>\n<p>Check out more variants on <b>home_url<\/b> in the <a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/home_url\" rel=\"noopener\" target=\"_blank\">codex<\/a>.<\/p>\n<p>You can also use the new <b>get_home_url<\/b> template tag retrieves the home url for a given site:<\/p>\n<p><code>&lt;?php get_home_url(); ?&gt;<\/code><\/p>\n<p>More info on <b>get_home_url<\/b> is also available in the <a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/get_home_url\" rel=\"noopener\" target=\"_blank\">codex<\/a>.<\/p>\n<p>Also new in WordPress 3.0 is <b>admin_url<\/b> and <b>get_admin_url<\/b> to retrieve the url to the admin area for a given site:<\/p>\n<p><code>&lt;?php get_admin_url(); ?&gt;<\/code><\/p>\n<p>There&#8217;s not much in the codex about these two yet, but check back at the <a href=\"http:\/\/codex.wordpress.org\/Template_Tags\" rel=\"noopener\" target=\"_blank\">Template Tags<\/a> page for more soon.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I love when template tags get shorter, don&#8217;t you? Whereas previously we might use bloginfo(&#8216;url&#8217;) or get_option(&#8216;site_url&#8217;), WordPress 3.0 has some new template tags: The new home_url template tag retrieves the home url for the current site. Here&#8217;s the default way to use it: &lt;?php home_url(); ?&gt; Check out more variants on home_url in the [&hellip;]<\/p>\n","protected":false},"author":4099,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[1,557,235],"tags":[10211,4993],"tutorials_categories":[],"class_list":["post-34579","post","type-post","status-publish","format-standard","hentry","category-news-community","category-development","category-misc","tag-admin","tag-templates"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/34579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/4099"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=34579"}],"version-history":[{"count":2,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/34579\/revisions"}],"predecessor-version":[{"id":182458,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/34579\/revisions\/182458"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=34579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=34579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=34579"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=34579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}