New answers tagged

2

The solution to restrict access to author's archives with .htaccess rule does pretty decent job. However, not everyone can edit or have access to .htaccess, especially on shared hosting accounts. The code below require PHP version 5.3+. Here is the solution which deals with the problem on WordPress level. Put this code in your theme's function.php file: &...


0

Here is what I came up with. Seems to be working. If anyone has suggestions for improvement, I'm all ears: // Redirect links to future posts to Coming Soon page. add_action('wp','redirect_coming_soon_posts', 0); function redirect_coming_soon_posts(){ global $wpdb; if ($wpdb->last_result[0]->post_status == "future" && $wpdb->...


0

not a wp_redirect(), but you could do a JavaScript redirect: window.location="http://www.example.com"; won't do anything if the user has JS disabled, so make sure to provide a link for the redirect.


6

Shortcode functions are only called when the content of the visual editor is processed and displayed, so nothing in your shortcode function will run early enough. Have a look at the has_shortcode function. If you hook in early enough to send headers and late enough for the query to be set up you can check if the content contains your shortcode and ...



Top 50 recent answers are included