There is a new function in WordPress that has been causing me some headaches, and I want to spare you the same grief.
I was deleting a page on my site, with the idea of completely recreating it with new content.
I deleted the page, and began to create a new one only to find the post name was being appended with -2 for example contact-2, I could not for the life of me work out why this was happening, I tried deleting the page again and recreating it, I was banging my head against a brick wall, when I noticed a new link on my edit pages section:
I am not sure when this trash can was added, I think it was in 2.9.x. Please leave a comment if I have been dim and trash has been around for an age.
My problem was that a reference to the page I wanted to create was still there, the page had been moved to trash awaiting the final step of me emptying the trash can. Arrghhh!! nearly one hour chasing my tail.
In the same way you can recover deleted files from your mac or PC by recovering items from trash you can now recover deleted post and pages from the trash if you are a bit too click happy with the delete button.
A cool new feature, as long as you know it is there and what repercussions it will create.
If you are having weird issues with duplicate names when creating pages and posts, have a quick look in trash, this may be the root of your problem.
I was recently working on a clients site, and that site has accumulated over 8000+ spam comments. Unfortunately the site did not have an anti-spam plugin activated, so the comments were being held in the moderation queue making comments on the site unusable.
I thought I could install and activate akismet, then run the re-check queue function. In essense this procedure re-runs the akismet check against all unmoderated comments, and any that match spam profiles are binned.
Due to the large number of spam messages, the re-check queue function timed out and would not perform the check.
The only thing for me to do was to run some sql commands directly against the database and delete the unmoderated comments tbat way.
Because I don’t do things easily, I did not have access to the backend database, I would have to find a solution inside of WordPress.
First thing was to install a plugin which allows me to run comamnds directly against the wqordpress database, the Plugin I like to use for this purpose is wp-dbmanager, you can download this plugin from http://wordpress.org/extend/plugins/wp-dbmanager/
Once installed there are various options to maintain your database, optimise table, but the main function I wanted was the ability to run a query, there is an option to do this.
I ran the following query against my clients database:
DELETE from `wp_comments` WHERE `comment_approved` = ‘0′;
This is a powerful command, make sure you understand it before you go ahead, what it is saying is delete all rows from the table wp-comments where comment_approved = 0 or where a comment is not moderated. This will not delete approved comments, only comment sitting in the moderation queue.
The 8000+ spam comments were gone, akismet is installed and my client now has the confidence to re-open comments if they so choose. A neat little fix.
Once you know about wp-dbmanager there are a hundred and one admin tasks you can perform, but please use with caution and after a backup because you can also irreparably harm your site, that was my polite way of saying if you don’t know SQL commands don’t mess
Sometimes you want to add some content to your blog, and you don’t want it to appear on your front page. Here is a time travelling tip for wordpress.
You may not want content to appear on your front page for a number of reasons:
My example is, I was creating members only content on my site and I did not want it to appear on the main page, to distract none members, so I buried in the archives.
For those of you who do not follow Dr Who, the Tardis is a time travelling machine, and WordPress comes complete with it’s own tardis so you can make post appear back in history.
To take advantage of this trick, create your post in the normal way and save it as a draft.
There is a little box called publish immediately under the save draft button, click on that and a time and date of publication is shown.
You can set a post to be published in the past, and it drops into your archives and off the front page. Neat-o!
I wrote a post about time travelling to the future with wordpress here Write Now Post later
If you want to mess about with your blog’s time space continuum this is a great trick.
Using native WordPress functiuonality it is very easy to create a controlled environment where multiple writers can add and publish posts on your blog.
The main technology behind this are WordPress roles. As you add users to your blog, assign them to roles and this then controls if they can write blog posts and more importantly if they can publish them without your intervention.
Roles are available at users -> authors and users from yoru dashboard.
This is the main user that is created when you install wordpress. it can do everything, from creating posts , publishing posts to doing technical tasks on the blog, we are note really interested in admins for multi writer purposes.
This is the boss of your blog writers, this role shouts stop the press (or don’t click the publish button) can add content, publish it, delete it and have compelte editorial control of blog posts and pages. They can delete old posts from anyone.
What the editor cannot do it effect technical aspects of your sitem ad plugins change themes that type of thing.
This role could be thought of as a staff writer on a national newspaper. Your typical hack, cigarette out of the corner of his mouth, ringing his contacts, chasing the story dreaming of the Pulitzer, hang on did I just go off on one there.
This is someone you trust to write on your blog, they have writing and publishing permissions, the editor can cut them off at the knees with one swift unpublish click, but there stuff will go live without editorial intervention.
This is your lowest level of writer, think of them as a freelancer on a newspaper, they write their piece and send it in to the editor for publication. Contributors can login and write their blog posts and submit them for review, that is it. they cannot delete their old posts that have been published or publish new posts.
If you have occasional guest posters, this may be the role for them, they add a post, then you review and decide if it is ready for publication.
For completeness I thought I would add subscriber, this is the end reader with a twist, this is someone who has created an account on your site, think of this as someone who has a magazine regularly delivered, they have a little more access to your site than a casual purchaser of a magazine. They cannot create posts.
Here is a detailed description of the various WordPress roles in WordPress Roles Explained