Advertisement
Guest User

Re-direccionar de forma aleatoria WordPress [Israel Pérez]

a guest
Dec 12th, 2019
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.23 KB | None | 0 0
  1. <?php
  2.  
  3. $args = array(
  4. 'posts_per_page' => 1,
  5. 'orderby' => 'rand'
  6. );
  7.  
  8. $random_redirect = new WP_Query ( $args );
  9.  
  10. while ( $random_redirect->have_posts () ) {
  11. $random_redirect->the_post ();
  12. wp_redirect ( get_permalink () );
  13. exit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement