Option does not save or update upon page refresh

Maybe a little debugging will help. Try this in your piece no.1 $theme = AisisCore_Factory_Pattern::create(‘AisisCore_Template_Builder’); if(isset($_POST[‘aisis_reset’])){ $theme->reset_theme_options(); } $options = get_option(‘aisis_reset’); print_r( $options ); //outputs $options value wp_die(); //will halt further process if($options == ‘true’){ echo ‘<div class=”alert alert-success”><strong>SUCCESS!!!!</strong> All Options have been reset! You can start again!</div>’; update_option(‘aisis_reset’, ‘false’); } What value do you … Read more

Multi-part form and wp_redirect()

You have a form like <form action=”http://some/url/form_two.php” method=”POST”> <input type=”whatever” value=”nothing” /> <input type=”hidden” name=”form_one_displayed” value=”1″ /> <input type=”submit” value=”Send” /> </form> in e.g form_one.php In form_two.php you validate the data that was send (or not) <?php $result = do_some_validation_with( $_POST ); if ( false == $result ) wp_redirect( ‘form_one.php’ ); else display_form_two(); function do_some_validation_with( … Read more

pre_get_posts redirecting

you can allow only registered user to see your content by 1.this solution for post show only to login user class RavsPublic { function __construct() { add_action(‘pre_get_posts’, array($this, ‘try_redirect’)); } function try_redirect( $query ) { // not on home page and not login if( !is_home() && !is_user_logged_in() ){ // send them to home page wp_redirect( … Read more

wp_redirect only works for external pages

Next should be in a comment, not in a answer, but is too long, so I’m sorry posting here and hope it helps. You don’t post the code, but it seems you are experiencing and endless redirect. Usually this happen when: The page is opened, user is not logged and so redirect The page is … Read more

A blank page is shown after I add a Function

Have you tried this: <?php add_action( ‘template_redirect’, ‘wp138320_template_redirect’ ); function wp138320_template_redirect() { if ( ! current_user_can( ‘manage_options’ ) ) { include( get_template_directory() . ‘/holding.php’ ); exit; } } ?> I’m currently working on a site that has issues with hooking into actions/filters like that too, changing it to something like the code above did the … Read more