How can I change page content for good once a button is pressed?

Do I understand problem correctly? [QR1] -> Scan -> [Claim listing] -> [QR1->QR2 claimed] -> [QR2] Here what comes to mind class RenderPage function gen_qr(is_claimed) if (is_claimed) return generate_qr2; else return generate_qr1 function display_page() $qr_code = gen_qr(get_option(‘<page_id>_qr’)); // on button click update_option(‘<page_id>_qr’) It’s a bit schematic, but I think you got the idea. P.S. Just … Read more

Show post object of any page in frontend

Because in functions.php, it is too early to just run the print_r(), you may run it within a init hook like this: Placing it inside theme’s functions.php add_action( ‘init’, ‘test_trace’ ); function test_trace() { global $post; print_r($post); }

How can I see $post object in frontend from functions.php?

Adding: global $post; print_r ($post); alone, won’t work in functions.php (becuase WP’s core functions etc wouldn’t be loaded). It would inside a relevant template file, but not in functions.php. To make it work in functions.php, you need to do it inside an function that is hooked to an appropriate hook. The “appropriate” hook may depend … Read more