is_front_page is not working in my functions.php

Question

is_front_page() in the below code is not working… this function just doesn’t run when I’m on the front page, any idea why? am I doing something wrong?

function save_landing_page_slider()
{
    
        if (isset($_GET['slider']) && is_front_page()) {
                $current_user_id = get_current_user_id();
                $slider = $_GET['slider'];
                update_field('user_landing_slider', $slider, 'user_'.$current_user_id);
        }
   
   
}
add_action('init', 'save_landing_page_slider', 10, 2);

0
user205498 4 months 2021-07-11T19:49:30-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse