Start Your Domain Search

Markit Media Blog

Using Relative URLs

Using Reletive URLs in your WordPress Blog Posts has a few advantages, not to mention it’s just a good practice. Relative URLs will make your posts smaller, decreasing page load times, and will greatly reduce the headache of moving a site to a new domain. Our WordPress Specialist at Markit Media want to share a quick and easy way to automatically make all of your WordPress site URLs relative. Open your functions.php located in your theme directory and paste in the following code:


= array(

'post_link',       // Normal post link

'post_type_link',  // Custom post type link

'page_link',       // Page link

'attachment_link'// Attachment link

'get_shortlink',   // Shortlink

'post_type_archive_link',    // Post type archive link

'get_pagenum_link',          // Paginated link

'get_comments_pagenum_link'// Paginated comment link

'term_link',   // Term link, including category, tag

'search_link'// Search link

'day_link',   // Date archive link

'month_link'// Month archive link

'year_link'// Year archive link


    foreach ( 
$link_filters as $link_filter ) {

add_filter$link_filter'wp_make_link_relative' );



That’s all folks. Happy Blogging!That’s all folks. Happy Blogging!

Be Sociable, Share!
Posted in Tips & Tricks, Uncategorized, WordPress | Tagged , |
Be Sociable, Share!