Advertisement
Guest User

Untitled

a guest
Jun 11th, 2012
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. add_action( 'template_redirect', 'rw_relative_urls' );
  2.  
  3. function rw_relative_urls() {
  4.     if ( is_feed() )
  5.         return;
  6.    
  7.     $filters = array(
  8.         'post_link',       // Normal post link
  9.         'post_type_link',  // Custom post type link
  10.         'page_link',       // Page link
  11.         'attachment_link', // Attachment link
  12.         'get_shortlink',   // Shortlink
  13.         'post_type_archive_link',    // Post type archive link
  14.         'get_pagenum_link',          // Paginated link
  15.         'get_comments_pagenum_link', // Paginated comment link
  16.         'term_link',   // Term link, including category, tag
  17.         'search_link', // Search link
  18.         'day_link',   // Date archive link
  19.         'month_link',
  20.         'year_link',
  21.     );
  22.     foreach ( $filters as $filter ) {
  23.         add_filter( $filter, 'wp_make_link_relative' );
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement