Advertisement
Imperative-Ideas

Conditionally disable canonical URLs for pagination

May 5th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. // Disable canonical urls for pagination
  2. add_filter( 'redirect_canonical','custom_disable_redirect_canonical' );
  3. function custom_disable_redirect_canonical( $redirect_url ){
  4.     global $post;
  5.     $ptype = get_post_type( $post );
  6.     if ( $ptype == 'collection' && is_archive() ) $redirect_url = false;
  7.     return $redirect_url;
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement