Tag Info

Hot answers tagged

4

Just look at the source of get_post_type_archive_link(): return apply_filters( 'post_type_archive_link', $link, $post_type ); Sidenote: The function uses home_url(), which is a wrapper for get_home_url(), which offers another filter: return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id ); that runs earlier. With "pretty permalinks" ...


4

Welcome to WPSE Ittikorn! Sometimes it is the easiest to just look right at the source. There even is a link right at the bottom of the Codex page you linked: https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes/link-template.php#L1112 There you can easily see that there actually is a filter called post_type_archive_link So to give you an ...


3

The filter is post_type_archive_link, defined (WP 4.1.1) on line 1112 of file wp-includes/link-template.php: apply_filters( 'post_type_archive_link', $link, $post_type ); And the use: add_filter( 'post_type_archive_link', function( $link, $post_type ) { //Do something return $link; }, 10, 2 );


2

The Easy Way This is by far and away the easiest approach to this, but unless you are willing to be a little bit flexible with how you present your archive it's not for you. The easy solution is achieved using the wp_get_archives() function. Unfortunately though there is no filter available to manipulate the output, so you'll be left with a list like this. ...


2

You can extend the get_the_archive_title filter which I've mentioned in this answer add_filter( 'get_the_archive_title', function ($title) { if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { ...



Only top voted, non community-wiki answers of a minimum length are eligible