[wp-trac] [WordPress Trac] #20283: Create new variable or function in $wp_query object to get canonical URL of any site's page
WordPress Trac
wp-trac at lists.automattic.com
Sat Mar 24 09:50:11 UTC 2012
#20283: Create new variable or function in $wp_query object to get canonical URL of
any site's page
-------------------------+------------------------------
Reporter: egorpromo | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Canonical | Version: 3.3.1
Severity: normal | Resolution:
Keywords: |
-------------------------+------------------------------
Comment (by egorpromo):
For single posts it is possible to get canonical URL by used
get_permalink() function or if we have paged post by used
[http://core.trac.wordpress.org/ticket/16973 some function] that will be
in future versions.
For any archive page there is no decision. It is possible to use
get_pagenum_link() function in way like
get_pagenum_link($wp_query->query_vars[ "paged" ]), but it is odd. If we
have URL with unnecessary parameter like
http://example.com/?cat=3&some_param=some_var (‘some_param’ is odd and
unnecessary parameter) it makes parameter will be in every another page
like http://example.com/?cat=3&some_param=some_var&page=2.
Conclusion. Now we can retrieve canonical URL for single post (or single
page or single attachment) only.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20283#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list