Redirect 404 to Homepage
add_action( ‘template_redirect’, function() { if (is_404()) { wp_safe_redirect(home_url()); exit(); } } );Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
add_action( ‘template_redirect’, function() { if (is_404()) { wp_safe_redirect(home_url()); exit(); } } );Continue reading
/** * IMPORTANT: After activating this snippet you have to change the default avatar option in Settings » Discussion to “Custom Avatar” as defined below. */ add_filter( ‘avatar_defaults’, function( $avatar_defaults ) { $new_avatar_url = ‘https://wpcode.com/wp-content/uploads/2024/09/wpcode-avatar.png’; // Replace this with your…Continue reading
$number_of_posts = 5; // Change this to the number of random posts you want to display. $title = ‘You might also like:’; // This is the title that will be displayed above the list of posts. $current_post_id = get_the_ID(); $args…Continue reading