add_action('init', 'save_landing_page_slider', 10, 2);
init
is too early — if you look at the WordPress query overview on Codex, init
is (as of writing) the second step, whereas is_
variables like $is_page
(or WP_Query::$is_page
) that are used by conditional tags like is_front_page()
are only set in step 4, so instead of init
, you should use a later hook like wp
or template_redirect
:
add_action( 'template_redirect', 'save_landing_page_slider' );
So in order for conditional tags to work properly, make sure to call them in the right hook or place.
Additionally, you should also understand when would is_front_page()
return true, e.g. when your homepage is set to a static Page, and that you’re on the homepage.