Showing posts with label wordpress. Show all posts
Showing posts with label wordpress. Show all posts

Monday, March 28, 2022

Wordpress customizations inside functions.php

Here are few tips on how to customize your Wordpress, without having to resort to plugins, just insert the following php code inside your functions.php file. I will be adding more.

Redirect inner page to outer domain:
add_action('template_redirect','redirect_from_to');
function redirect_from_to(){
  if (is_page('mypage')){
    wp_redirect('http://www.google.com',301);
    exit()
  }
}
Note: mypage must be created in order for the redirect to work.


Allow svg files to be uploaded:

function cc_mime_types($mimes){

$mimes['svg']='image/svg';

return $mimes;

}

add_filter('upload_mimes','cc_mime_types');


Cheers!

Subscribe To My Channel for updates