WordPress Feed Invalid Char

When you open your WordPress sites RSS feed in the browser you get the following error:

“WordPress Feed Invalid Char”

The error will also show you the the line number of the error.

View the source of the feed and go to the line of the error. Find the corresponding post in your WordPress admin.

Copy the title and body into notepad (note this will remove all formatting).

You will be able to see the non UTF8 characters in notepad and be able to delete them. You can then copy and paste the problem text back into WordPress.

The offending characters won’t show in the WordPress admin hence having to copy into notepad.

How to Post to Twitter & Facebook from WordPress

There are a lot of different plugins for posting to Twitter or Facebook from within WordPress however the easiest I’ve found is through a plugin called Social.

Social allows you to add Twitter and Facebook accounts from settings then when you post new content it prompts you to automatically post to the social networks.


WordPress Pages & Posts not showing

If when you load the wordpress admin none of your pages & posts are showing, do the following:

  1. Edit wp-config.php and add
    define('WP_ALLOW_REPAIR', true);
  2. Open the database repair URL

This should force an upgrade of the database. Remember to remove the line from wp-config after running the upgrade.

Find Most Recent Comments

To find the most recent comments in WordPress use the following code:

$number=30; // number of recent comments desired
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
if ( $comments ) : foreach ( (array) $comments as $comment) :
echo sprintf(__('%1$s on %2$s'), get_comment_author_link(), '' . get_the_title($comment->comment_post_ID) . ' - ') . $comment->comment_date;

Find the most recent posts from a specific category

In WordPress sometimes you will want to show the most recent post from a specific category.

To do this use the following code:

global $post;
//change the category=1442 to the category number you want to pull the content from
//change numberposts=1 to the number of posts you want to return from the category
$myposts = get_posts('numberposts=1&category=1442&order=DESC');
foreach($myposts as $post) :
$catpost= " ". get_the_title() ."";

echo $catpost;

Unable to locate WordPress Content directory (wp-content)

When you try to update/install a WordPress plugin you get the following error:

“Upgrade Plugin: Unable to locate WordPress Content directory (wp-content)”

Add the following code to the end of your wp-config.php file:
if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );