daily pastebin goal
18%
SHARE
TWEET

Untitled

a guest Jun 11th, 2012 207 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top