Title: Scriptrunner (Doug Sparling)'s Replies - page 20 | WordPress.org

---

# Scriptrunner (Doug Sparling)

  [  ](https://wordpress.org/support/users/scriptrunner/)

 *   [Profile](https://wordpress.org/support/users/scriptrunner/)
 *   [Topics Started](https://wordpress.org/support/users/scriptrunner/topics/)
 *   [Replies Created](https://wordpress.org/support/users/scriptrunner/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/scriptrunner/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/scriptrunner/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/scriptrunner/engagements/)
 *   [Favorites](https://wordpress.org/support/users/scriptrunner/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 286 through 300 (of 520 total)

[←](https://wordpress.org/support/users/scriptrunner/replies/page/19/?output_format=md)
[1](https://wordpress.org/support/users/scriptrunner/replies/?output_format=md) 
[2](https://wordpress.org/support/users/scriptrunner/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/scriptrunner/replies/page/3/?output_format=md)…
[19](https://wordpress.org/support/users/scriptrunner/replies/page/19/?output_format=md)
20 [21](https://wordpress.org/support/users/scriptrunner/replies/page/21/?output_format=md)…
[33](https://wordpress.org/support/users/scriptrunner/replies/page/33/?output_format=md)
[34](https://wordpress.org/support/users/scriptrunner/replies/page/34/?output_format=md)
[35](https://wordpress.org/support/users/scriptrunner/replies/page/35/?output_format=md)
[→](https://wordpress.org/support/users/scriptrunner/replies/page/21/?output_format=md)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [URL Redirect / .htaccess / subdomain / maintenance page madness](https://wordpress.org/support/topic/url-redirect-htaccess-subdomain-maintenance-page-madness/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/url-redirect-htaccess-subdomain-maintenance-page-madness/#post-4181685)
 * If you just want to redirect any path/url for newsite.com to the home page of
   oldsite.com, then just use this simple redirect in .htaccess on newsite.com web
   root directory.
 *     ```
       Redirect 302 / http://www.oldsite.com/
       ```
   
 * Use a 302 instead of a 301 as you don’t want this redirect to be considered permanent.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Brute force attack solution via .htpasswd?](https://wordpress.org/support/topic/brute-force-attack-solution-via-htpasswd/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/brute-force-attack-solution-via-htpasswd/#post-4179992)
 * Are you saying that you are adding an Apache basic authentication on your login
   page (using htpasswd) so you have to get past that before you can log into WordPress?
   If so, once you’ve authenticated successfully via basic auth, then it stays active
   until you close your browser.
 * Another option would be to use a Limit Login attemps plugin (there are several)
   or WP Better Security, which also limits the amount of times a user can attempt
   to login. However, there’s nothing wrong with putting basic authentication in
   front of your admin page.
 * What you’ve done is actually one of the suggestions in the Codex page on brute
   force attacks (but there’s other good info there too):
 * [Codex: Brute Force Attacks](http://codex.wordpress.org/Brute_Force_Attacks)
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [wp_list_pages() and throwing PHP warnings](https://wordpress.org/support/topic/wp_list_pages-and-throwing-php-warnings/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/wp_list_pages-and-throwing-php-warnings/#post-4180637)
 * I don’t – it works fine for me using default WordPress Twenty Thirteen theme.
 * Could you post the errors? It’s quite possibly your theme or a plugin. (try disabling
   all plugins and switching to a default WordPress theme to verify)
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Some external links on pages not working](https://wordpress.org/support/topic/some-external-links-on-pages-not-working/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/some-external-links-on-pages-not-working/#post-4181161)
 * You’re using a frameset for some reason, that seems to be breaking links.
 * If I navigate to “Links and Resources,” links aren’t working, but if I got straight
   to the page in the frameset:
 * [http://alaskaseafoodcooperative.org/WP/links-and-resources-2/](http://alaskaseafoodcooperative.org/WP/links-and-resources-2/)
 * Don’t use frames.
 * If you don’t want your main url:
 * [http://alaskaseafoodcooperative.org/WP](http://alaskaseafoodcooperative.org/WP)
 * to contain the “WP,” then there are better was to do that.
 * [Codex: Giving WordPress Its Own Directory](http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory)
 * [Moving WordPress from Subdirectory to Root – FAQ](http://askwpgirl.com/moving-wordpress-from-subdirectory-to-root-faq/)
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [where does get_term_link() go to?](https://wordpress.org/support/topic/where-does-get_term_link-go-to/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/where-does-get_term_link-go-to/#post-4177454)
 * If no one else responds first, I’ll try and take a look when I have some time…
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Posts Page ID](https://wordpress.org/support/topic/posts-page-id/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/posts-page-id/#post-4179963)
 * To find the page that contains the posts (the listing of posts), you use:
 * `get_option('page_for_posts')`
 * as alchymyth said.
 *     ```
       $posts_page_id = get_option( 'page_for_posts' );
       echo "posts page id: " . $posts_page_id;
       ```
   
 * The caveat is that this value will only be set if you assign a static page for
   your front page and assign another page for your posts page (via Settings->Reading).
   When you run WordPress where the front page displays your blogs posts, that’s
   a special case and there is no “posts page” id. (actually, I think it comes back
   as 0).
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Cannot redeclare has_shortcode WP 3.6.1](https://wordpress.org/support/topic/cannot-redeclare-has_shortcode-wp-361/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/cannot-redeclare-has_shortcode-wp-361/#post-4180487)
 * You just need to rename `has_shortcode` in functions.php to something unique (
   as of WordPress 3.6, it includes a function of the same name). Then you need 
   to update the add_action or whatever is calling your function to use the same,
   updated name.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Illegal string offset 'sidebar' error on some pages](https://wordpress.org/support/topic/illegal-string-offset-sidebar-error-on-some-pages/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/illegal-string-offset-sidebar-error-on-some-pages/#post-4178497)
 * That’s actually a warning, not an error, so it won’t cause a runtime error.
 * > Error: Fatal run-time errors. These indicate errors that can not be recovered
   > from, such as a memory allocation problem. Execution of the script is halted.
   > Warning: Run-time warnings (non-fatal errors). Execution of the script is not
   > halted.
 * This also tells me you’re running your WordPress site with debug mode on, which
   is not a good practice.
 * In wp-config.php, change:
 *     ```
       define('WP_DEBUG', true);
       ```
   
 * to:
 *     ```
       define('WP_DEBUG', false);
       ```
   
 * As far as the warning message itself:
 *     ```
       Warning: Illegal string offset 'sidebar'
       ```
   
 * This generally means that your code is trying to access a key in an array that
   doesn’t exist. The theme author needs to fix that by checking that a key in the
   array exists (is_set) before trying to access it.
 * It does indicate a problem with the code, but not a fatal one. I often see piles
   of Warning messages from various plugins when I turn on DEBUG. (which doesn’t
   make it right, but sadly it isn’t uncommon) At the very least, set DEBUG to false
   so the Warnings won’t display on your production site.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Embedding and Uploading a .SWF File](https://wordpress.org/support/topic/embedding-and-uploading-a-swf-file/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/embedding-and-uploading-a-swf-file/#post-4179850)
 * I have clients who still need to upload swf files (but only their admin user).
   I’d never allow an upload of an exe file, though, which was also disabled in 
   WordPress 3.6.1.
 * If it’s only you (the admin) and you’re aware of the potential risks here’s how
   to allow swf uploads:
 * [[resolved] Can’t upload swf files to wordpress anymore](http://wordpress.org/support/topic/cant-upload-swf-files-to-wordpress-anymore?replies=6)
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Can't upload swf files to wordpress anymore.](https://wordpress.org/support/topic/cant-upload-swf-files-to-wordpress-anymore/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/cant-upload-swf-files-to-wordpress-anymore/#post-4172970)
 * chrisntoukas, you’re quite welcome! If you don’t mind, please mark the topic 
   as resolved to help others who may have run across the same incorrect code in
   the other post.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Proper Category and Tag base 301 redirection](https://wordpress.org/support/topic/proper-category-and-tag-base-301-redirection/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/proper-category-and-tag-base-301-redirection/#post-4166433)
 * If I understand your question correctly (you want to redirect a “subcategory”),
   then just modify that redirect and place it after the category->newcat redirect
   you alrady added:
 * `Redirect 301 /newcat/books/ http://www.example.com/newcat/articles/`
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Exclude Single Post View of Certain Categories](https://wordpress.org/support/topic/exclude-single-post-view-of-certain-categories/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/exclude-single-post-view-of-certain-categories/#post-4176856)
 * Add this to your themes functions.php and see if it works for you. It might need
   a little tweaking, just let me know:
 *     ```
       function exclude_category( $query ) {
           // Add your category id(s) here
           $excluded_category_ids = array(1,17);
           if ( $query->is_main_query() ) {
               if ( ( $query->is_home() || $query->is_category() || $query->is_archive() || $query->is_feed() ) || ( !is_admin() && $query->is_search() ) ) {
                   $query->set('category__not_in', $excluded_category_ids);
               } elseif ( $query->is_single() ) {
                   $post_categories = wp_get_post_categories( $query->query_vars['p'] );
                   foreach ($excluded_category_ids as $category_id ) {
                       if ( in_array( $category_id, $post_categories ) ) {
                           $query->set( 'p', -$category_id );
                           break;
                       }
                   }
               }
           }
       }
       add_action( 'pre_get_posts', 'exclude_category' );
       ```
   
 * Just change:
 *     ```
       $excluded_category_ids = array(1,17);
       ```
   
 * to include whatever category ids you want to exclude. Must be an array (but it
   can contain just one element).
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Exclude Single Post View of Certain Categories](https://wordpress.org/support/topic/exclude-single-post-view-of-certain-categories/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/exclude-single-post-view-of-certain-categories/#post-4176852)
 * OK, cool. I’ll take a look and see what I can come up with (as I have time).
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Exclude Single Post View of Certain Categories](https://wordpress.org/support/topic/exclude-single-post-view-of-certain-categories/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/exclude-single-post-view-of-certain-categories/#post-4176842)
 * So basically you don’t want the post to be visible in any view that would normally
   show it? (single, category, tag, archive, etc) What do your custom made elements
   rely on, if anything, to display these particular posts? (category?) I assume
   it’s different from making the posts private? Is there any particular plugin 
   that comes closest to what you want?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [where does get_term_link() go to?](https://wordpress.org/support/topic/where-does-get_term_link-go-to/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/where-does-get_term_link-go-to/#post-4177332)
 * Without sample code, it’s hard to say. Did you check out the Codex example?
 * [Function Reference/get term link](http://codex.wordpress.org/Function_Reference/get_term_link)

Viewing 15 replies - 286 through 300 (of 520 total)

[←](https://wordpress.org/support/users/scriptrunner/replies/page/19/?output_format=md)
[1](https://wordpress.org/support/users/scriptrunner/replies/?output_format=md) 
[2](https://wordpress.org/support/users/scriptrunner/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/scriptrunner/replies/page/3/?output_format=md)…
[19](https://wordpress.org/support/users/scriptrunner/replies/page/19/?output_format=md)
20 [21](https://wordpress.org/support/users/scriptrunner/replies/page/21/?output_format=md)…
[33](https://wordpress.org/support/users/scriptrunner/replies/page/33/?output_format=md)
[34](https://wordpress.org/support/users/scriptrunner/replies/page/34/?output_format=md)
[35](https://wordpress.org/support/users/scriptrunner/replies/page/35/?output_format=md)
[→](https://wordpress.org/support/users/scriptrunner/replies/page/21/?output_format=md)