php - Execute wp_logout_url('/') in Javascript -
i want check javascript based on condition want log user out. how call php js? doing research find lots on info on how create logout link, trying execute inside js instead.
something like:
if(variable == 1) { execute logout no confirmation (in php function show link "<?php echo wp_logout_url('/redirect/url/goes/here') ?>") } else { else here; };
wouldn't setting location.href
trick,
url pre-rendered php?
if( variable == 1 ) { window.location.href = '<?php echo wp_logout_url('/redirect/url/') ?>'; } else { //do else here; };
Comments
Post a Comment