top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to automatically remove default video links in WordPress?

0 votes
586 views

I am looking for the user to redirect to the home page when the user tries to access the video permalink. So, how to automatically remove default video links.

function wpb_imagelink_setup() {
$image_set = get_option( 'image_default_link_type' );

if ($image_set !== 'none') {
    update_option('image_default_link_type', 'none');
  }
}
add_action('admin_init', 'wpb_imagelink_setup', 10);

I tried the above code, but it doesn't work

posted May 17, 2017 by Kavyashree

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes
 
Best answer

Actually you need to redirect the users via template_redirect hook that you can use as per below.

add_action( 'template_redirect', 'redirect_to_specific_page' );

function redirect_to_specific_page() {

$image_set = get_option( 'image_default_link_type' );

if ( is_page($image_set) && ! is_user_logged_in() ) {

wp_redirect( 'http://www.yourhomepage.com/', 301 ); 
  exit;
    }
}

Check the $image_set is getting correct URL.

answer Jul 19, 2017 by anonymous
0 votes

Actually you need to redirect the users via template_redirect hook that you can use as per below.

add_action( 'template_redirect', 'redirect_to_specific_page' );

function redirect_to_specific_page() {

$image_set = get_option( 'image_default_link_type' );

if ( is_page($image_set) && ! is_user_logged_in() ) {

wp_redirect( 'http://www.yourhomepage.com/', 301 ); 
  exit;
    }
}
answer May 22, 2017 by Anand Huded
Similar Questions
0 votes

I have a navigation menu I want each link within it will be a different color when active.
I do something like this:

.side_bar_nav li.current-menu-item a{
    color: #ff6633;
}

But this gives each link with the same color when active. But I want to target each link individually and give it its own color.
In below this is one of the link which I want to individual color when it active.

<li id="menu-item-49" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-home current-menu-item page_item page-item-9 current_page_item menu-item-49">
  <a href="http://fyberproperty.co.uk/">home</a>
</li>

Can anybody help me how I set its individual color when it active?

...