Redirect Pending Review Status Preview page url to custom url

function mmk_pending_review_redirect(){ $user = wp_get_current_user(); if(get_post_status ( get_the_id() ) != ‘publish’) if (is_user_logged_in() && !in_array( ‘administrator’, (array) $user->roles ) && !is_author() ) { wp_redirect( “https://example.com/under-approval”); exit; }else{ wp_redirect( “https://example.com/under-approval”) ); exit; } } } add_action(‘template_redirect’, ‘mmk_pending_review_redirect’); explanation: redirect non-admin users to custom URL if they are not author of the current post where status is … Read more

How to access my wordpress application using two URLs?

So this had been a constant issue for me but finally i got this working, thanks to this blog post. http://www.velvetblues.com/web-development-blog/turn-off-wordpress-homepage-url-redirection/ It seems like adding this in the functions.php file for the enabled theme works. Pasting here for anyone who may be facing a similar issue. remove_filter(‘template_redirect’,’redirect_canonical’); I restarted the httpd and the php-fpm service, … Read more

Redirect when not logged and parametr in link

This should work for what you’re looking to achieve; add_action( ‘template_redirect’, ‘redirect_to_specific_page’ ); function redirect_to_specific_page() { if ( ! is_user_logged_in() && ! is_page(‘one_time_login’) ) { wp_redirect( ‘domain.com/sub’, 301 ); exit; } } This should be added to your theme (or child theme) functions.php file

Puzzled at HTTP/2 301 response header

It might be that WordPress is just redirecting to the version with trailing slash. /cart => /cart/ /shop => /shop/ I’m having trouble, finding a good canonical source why WP is doing this. The fact is, that most web frameworks (I worked with) will force trailing slashes on their routes (that are not directed at … Read more