Better, more efficient redirecting
Better, more efficient redirecting
Better, more efficient redirecting
********** I think I have it *********** you can’t interrogate WP_query like I was trying to do. You must work with the $query parameter’s values like this: if( !$query->is_single() ) $query->set( ‘post__not_in’, array( 639 ) ); } So if it’s not a single Post, like in a list of Recent Posts or a list of … Read more
Since you’re inside the loop when calling the wp_login_url() you can just pass the get_the_permalink() as the $redirect url. <a href=”<?php echo wp_login_url( get_the_permalink() ); ?>”> <?php echo __( ‘Login’ ); ?> </a>
Use a 301 to Redirect any 404 from at the blog post level to the blog archive
If you are using WPML you can use its built-in language condition statement. if(ICL_LANGUAGE_CODE==’en’) Therefore you can put your redirect function in this. if(ICL_LANGUAGE_CODE==’en’){ // Your function }
Well, detecting a 404 from .htaccess isn’t possible. This is because the .htaccess file is going to route any requests for non-existing pages to the index.php file. From there, WordPress will do a lookup in the database to see if the current request matches any content in the database. If not, then WordPress returns a … Read more
The following code works for me, give it a try: function no_dashboard() { $user = wp_get_current_user(); if (in_array(‘subscriber’, (array)$user->roles)) { wp_redirect(site_url()); exit; } } add_action(‘admin_init’, ‘no_dashboard’);
after logged in it wont redirect to previous page It’s because in your loginform() function, the ‘redirect’ => home_url() below sets the redirect URL to the homepage URL: $args = array(‘redirect’ => home_url(), ‘id_username’ => ‘user’,’id_password’ => ‘pass’,); So if you want to redirect to the previous page, then remove the redirect argument above, or … Read more
Open wordpress page in directory the way index.html would open
Here’s an idea for you: If you create a script for importing the content from Drupal, using the node ID as a suggested ID for the new WP post (Otto has explained how to do this here: How can I assign post a specific ID on creation?), this would lead to your nodes being accessible … Read more