add_action('init', 'rastgele_yazi');
function rastgele_yazi(){
if ( isset($_GET['rastgele']) ){
$args = array(
'post_type' => 'product',
'posts_per_page' => 1,
'post_status' => 'publish',
'orderby' => 'rand',
'category__not_in' => array( 314,512 ),
);
$random = new WP_Query($args);
if ($random->have_posts()) {
while ($random->have_posts()) : $random->the_post();
$URL = get_permalink();
endwhile; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/URL]">
<html xmlns="[URL]http://www.w3.org/1999/xhtml[/URL]">
<head>
<meta http-equiv="Refresh" content="0; url=<?php echo $URL; ?>">
</head>
<body>
</body>
</html>
<?php }
die;
}
}
Hocam öncelikle ilgin için teşekkür ederim,/urun/xxx/ olarak yönlendiriyor bunu mesela /abcd/xxxx olarak yönlendirebilir miyim ? diğer kalıcı bağlantılarda olmayanlara gitsin aslında inşallah anlatabildim