53024_Wordpress not allowed to edit post

Expand / Collapse

There are two to three errors you generally receive when trying to add a new post in WordPress, despite being an administrator. They are all because of the same thing so I will simply list the errors I saw and the fix for them.

Errors!

  1. After clicking save draft or submit for publishing (or any of those buttons really) you receive the error "You are not allowed to edit this post"
  2. HTTP 500 error in your browser, again, after clicking those evil little buttons
  3. PHP Error log (ah yes, how I found the solution...duh) "WordPress database error Field 'post_mime_type' doesn't have a default value for query INSERT INTO `wp_posts` (lists fields)"

Solution(s)

The error appeared to be related to inserting a null value in the table which was not allowing it. This has come up in the past for other users historically and seems to be a random bug not creating the field correctly. Open an SSH connection to your MySQL database (or whatever tool you prefer that can run queries) and run the following:

ALTER TABLE wp_posts MODIFY post_mime_type VARCHAR(255);

Now obviously if you're getting the same exact error but from a different column you can always replace it. Here is a general query that you can modify yourself:

ALTER mytable MODIFY mycolumn varchar(255);

Notice I did not include 'null'. That is because varchar allows null values by default.



Rate this Article:


Details
Category: Wordpress

Last Modified:Wednesday, May 25, 2011 1:38 PM

Type: BUG

Level: Expert

Rated 3 stars based on 3 votes.

Article has been viewed 3,154 times.

Options
Email Article Email Article


Social Bookmarks Social Bookmarks