top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to automatically remove default video links in WordPress?

0 votes
27 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?

0 votes

I need to add a variable inside an array of an embedding gravity forms to populate 2 hidden fields: email and jobname.

Here is my code:

<?php 

    $email = get_field( "email_application" );
    $jobtitle = get_the_title();

    gravity_form( 5, false, false, false, array('email'=>'echo "$email";','jobname'=>'print "$jobtitle";'), false); 
?>

I know that echo, print or just the variable doesn't work as it show like this in my code:

<input name="input_6" id="input_5_6" type="hidden" value="print $jobtitle" class="gform_hidden" aria-invalid="false">

and

<input name="input_5" id="input_5_5" type="hidden" value="echo "$email";" class="gform_hidden" aria-invalid="false">

Instead I should get:

<input name="input_6" id="input_5_6" type="hidden" value="My job title" class="gform_hidden" aria-invalid="false">

and

<input name="input_5" id="input_5_5" type="hidden" value="myaddress@email.com" class="gform_hidden" aria-invalid="false">

Can someone could point me in the right direction.

Thank you.

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...