Redirect regex misbehaving when placeholder empty

The problem with your RegEx patterns: /code-examples/(.*) /code-examples/android/(.*) is that they only match when the ending slash (/) is present in the URL; e.g.: # Example 1: $1 is ‘page1’ /code-examples/page1 /code-examples/android/page1 # Example 2: $1 is ” (empty) /code-examples/ /code-examples/android/ # Example 3 # No matches because the ending / is not present. /code-examples … Read more

WP Redirect is not working

You’re using a + sign for the first instance of string concatenation. Using a . instead should fix it. Additionally, WordPress provides some useful functions that might make this code easier: wp_redirect( add_query_arg( array( ‘post_type’ => ‘property’, ‘search_keyword’ => $search_keyword, ‘submit’ => ‘Search’, ‘price-min’ => $price_min, ‘price-max’ => $price_max, ‘city’ => $address_city, ‘state’ => $address_state, … Read more

Redirect to Page URL for non-members

You can use use wp_redirect for that. Here is a simple code, it redirects non-users to website homepage. You can redirect them to a error page or on signup page. <?php if( mgm_user_is( array(‘level1’, ‘level2’ ) ) ) { wp_redirect( home_url() ); exit; } else { // show content } ?>

Use wp_redirect without filter in plugin file

Not too sure what is really going on there, but one thing for sure your if statement is flawed, you should remove unneeded ELSE, should be like this: if (is_user_logged_in()) { if (isset($_GET[‘id’])) { $id = $_GET[‘id’]; show_submission($id); } elseif(has_submission()) { $url=”http://”.$_SERVER[“HTTP_HOST”].$_SERVER[“REQUEST_URI”].’?id=’.$get_submission_id(); header(‘Location: ‘.$url); } else { show_form(); } } OR like this: if (is_user_logged_in()) … Read more

Redirection problems

If you can log in to phpmyadmin, you can check the wp-options table in the database to check the value below, if it’s website.com, you must edit two line below is demo.websiteA.com

WordPress wp_redirect() not working after get_header();

wp_redirect() works by sending a Location header. Headers cannot be sent after output has been sent to the browser. So you cannot output any HTML before calling wp_redirect(). Using wp_redirect() after get_header() never would have worked, which is why it doesn’t work when you roll back. The only way it could’ve worked is if header.php … Read more

redirect to /wp-admin/edit.php instead of wp_redirect url

You just need to change the second parameter for get_edit_post_link(), which is $context and defaults to display. And that parameter determines how to output the ampersand character (i.e. &), which defaults to being encoded as &amp; (because the default context is that the URL is being displayed, hence the & is encoded). When using the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)