Title: Scriptrunner (Doug Sparling)'s Replies - page 19 | 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 - 271 through 285 (of 520 total)

[←](https://wordpress.org/support/users/scriptrunner/replies/page/18/?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)…
[18](https://wordpress.org/support/users/scriptrunner/replies/page/18/?output_format=md)
19 [20](https://wordpress.org/support/users/scriptrunner/replies/page/20/?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/20/?output_format=md)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [help with displaying most recent post on static page](https://wordpress.org/support/topic/help-with-displaying-most-recent-post-on-static-page/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/help-with-displaying-most-recent-post-on-static-page/#post-4183164)
 * Awesome! You’re quite welcome.
 *   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-4176940)
 * OK, let’s try something different. Here’s the most basic code to only prevent
   your post from showing as is_single (similar to making all your posts for a particular
   category private).
 * So in my case, when I go to my blog page (or category page), then I see the post
   title. When I click on the link to go to the single post page, I get a 404 (if
   the post belongs to the excluded category) – ID 1 in my case, which is generally
   the Uncategorized category by default.
 *     ```
       function exclude_single_post( $query ) {
           $excluded_category_ids = array(1);
           if ( $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_single_post' );
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [How to add a copyright](https://wordpress.org/support/topic/how-to-add-a-copyright/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/how-to-add-a-copyright/#post-4183584)
 * For your entire site…you should be able to add copyright copy to your footer.
   php. You might look and see if any there are any plugins that’ll work for you.
 *   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-4176931)
 * What was happening before you disabled plugins? Was it just not working for the
   single post page?
 *   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-4176930)
 * Add this as the first line of your function:
 * `echo "<strong>exclude_category called</strong>";`
 * and see if it shows up at the top of your page. Want to make sure the function
   is actually getting called.
 * If you want to send it to your error log instead, use
 * `error_log("exclude_category called");`
 * instead…
 *   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-4176926)
 * And have you disabled any plugins you may have tried?
 *   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-4176925)
 * OK, this works perfectly for me, so let’s try and find what’s different. What
   works (if anything) and what doesn’t? (I assume the single doesn’t) That is, 
   are your specified posts hidden from category but still show on the single page?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Accessing wp-admin on a different port/url](https://wordpress.org/support/topic/accessing-wp-admin-on-a-different-porturl/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/accessing-wp-admin-on-a-different-porturl/#post-4183037)
 * The only thing I can think of (in regards to your original question) would be
   to use the WordPress `wp_insert_post_data` filter hook and remove the port (using
   a regex) before saving the post to the database.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Accessing wp-admin on a different port/url](https://wordpress.org/support/topic/accessing-wp-admin-on-a-different-porturl/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/accessing-wp-admin-on-a-different-porturl/#post-4183032)
 * Yes, dynamic IPs will pretty much make that solution impossible. (or incredibly
   difficult at best)
 * I’ve not ever used a separate port for WordPress admin specifically, though it
   should be possible.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [help with displaying most recent post on static page](https://wordpress.org/support/topic/help-with-displaying-most-recent-post-on-static-page/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/help-with-displaying-most-recent-post-on-static-page/#post-4183026)
 * Or if you’re “echo” adverse, you could do it like this: 🙂
 *     ```
       <?php
       $query = new WP_Query( array ( 'orderby' => 'date', 'order' => 'DESC', 'showposts' => '1' ) );
       if ( $query->have_posts() ) :
       ?>
           <?php $query->the_post(); ?>
           <li><?php the_title(); ?></li>
           <div class="entry-content">
           <?php the_content(); ?>
       	<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'scrappy' ), 'after' => '</div>' ) ); ?>
           </div><!-- .entry-content -->
           <span class="media-posted-on">
           <?php edit_post_link( __( 'Edit', 'scrappy' ), '<span class="media-edit-link">', '</span>' ); ?>
           </span>
       <?php
       endif;
       ?>
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [help with displaying most recent post on static page](https://wordpress.org/support/topic/help-with-displaying-most-recent-post-on-static-page/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/help-with-displaying-most-recent-post-on-static-page/#post-4183018)
 *     ```
       <?php
       $query = new WP_Query( array ( 'orderby' => 'date', 'order' => 'DESC', 'showposts' => '1' ) );
       if ( $query->have_posts() ) {
           $query->the_post();
           echo '<li>' . get_the_title() . '</li>';
           echo '<div class="entry-content">';
           the_content();
           wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'scrappy' ), 'after' => '</div>' ) );
           echo '</div><!-- .entry-content -->';
           echo '<span class="media-posted-on">';
           edit_post_link( __( 'Edit', 'scrappy' ), '<span class="media-edit-link">', '</span>' );
           echo '</span>';
       }
       ?>
       ```
   
 * Since you’re only wanting one post, I changed `while` to `if`, the the end result
   is the same.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Accessing wp-admin on a different port/url](https://wordpress.org/support/topic/accessing-wp-admin-on-a-different-porturl/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/accessing-wp-admin-on-a-different-porturl/#post-4182996)
 * Or even simpler:
 *     ```
       <FilesMatch wp-login.php>
       Order Deny, Allow
       Allow from xxx.xxx.xxx.xxx
       Deny from all
       </FilesMatch>
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Accessing wp-admin on a different port/url](https://wordpress.org/support/topic/accessing-wp-admin-on-a-different-porturl/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/accessing-wp-admin-on-a-different-porturl/#post-4182994)
 * I’d do one of two things.
 * 1) Add Apache basic-authentication in front of wp-login.php (via wp-admin/.htaccess).
 * 2) Only allow access to wp-login.php and admin to an internal IP:
 * Root-level .htaccess:
 *     ```
       <IfModule mod_rewrite.c>
       RewriteEngine on
       RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
       RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
       RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.xxx\.xxx$
       RewriteRule ^(.*)$ - [R=403,L]
       </IfModule>
       ```
   
 * Updating this line:
 *     ```
       RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.xxx\.xxx$
       ```
   
 * with your actual IP address.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Sharing ad revenue with authors](https://wordpress.org/support/topic/sharing-ad-revenue-with-authors/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/sharing-ad-revenue-with-authors/#post-4181712)
 * If ad rev share is an important part of your business (or even if not), I’d got
   with WPMU DEV. Besides being familiar with the company, the plugin appears to
   have a substantial amount of downloads and a good rating.
 * But looking on the WPMU DEV forums, I see this comment:
 * >  Q: The Ad Sharing plugin looks perfect for sharing revenue across authors,
   > but I only need it for a single wordpress install, not multisite. Is there 
   > a plugin like that?
   > Essentially I’d like to have all my authors get a percentage of the income 
   > from ads on the blog.
   > A: Unfortunately not. the ad sharing is designed for multiple sites users, 
   > not sharing with users on a single site.
 * They go on to suggest trying a plugin you already mentioned (note, the comment
   was from early this year):
 * [Revenue Share for Authors (RSP for WordPress)](http://wordpress.org/plugins/revenue-share-plugin-for-authorsrsp/)
 * So I’d check with WPMU if the plugin is truly for multisite only (if you’re not
   running multisite).
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Brute Force Attackers Know My Registrants' Usernames](https://wordpress.org/support/topic/brute-force-attackers-know-my-registrants-usernames/)
 *  [Scriptrunner (Doug Sparling)](https://wordpress.org/support/users/scriptrunner/)
 * (@scriptrunner)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/brute-force-attackers-know-my-registrants-usernames/#post-4181702)
 * I’ve not heard of that, though thinking of how this could happen a couple things
   come to mind. Can your registered users posts and are their names listed as author
   along with the posts if the can (this wouldn’t be the username, but a user’s 
   screen name might be guessed from that). I’d think if someone was sniffing open
   traffic (non-SSL), they’d get the password too. Or since passwords are encrypted
   in the database, maybe usernames were obtained somehow.
 * That all said, I’d just harden the site down even more and add additional security
   specifically for brute force attacks in general. I always use one of the many
   login lockdown plugins, or more lately, I just use that feature in Better WP 
   Security.
 * [Codex: Brute Force Attacks](http://codex.wordpress.org/Brute_Force_Attacks)

Viewing 15 replies - 271 through 285 (of 520 total)

[←](https://wordpress.org/support/users/scriptrunner/replies/page/18/?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)…
[18](https://wordpress.org/support/users/scriptrunner/replies/page/18/?output_format=md)
19 [20](https://wordpress.org/support/users/scriptrunner/replies/page/20/?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/20/?output_format=md)