wordpress admin can’t post new post after migrating to new server

Read a lot to resolve this but I am stuck…:-(

Moved a WP site from shared to linode VPS.

Read More

Configs:

WordPress 3.6.1
mysql Ver 14.14 Distrib 5.7.5-m15, for Linux (x86_64) using EditLine wrapper
PHP 5.5.18-1+deb.sury.org~precise+1 (cli) (built: Oct 17 2014 15:11:34)
apache
Server version: Apache/2.4.10 (Ubuntu)
Server built: Jul 22 2014 22:57:50
DB is ut8

Virtual host conf file:

DocumentRoot /home/userName/webSite

<Directory />
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    <Directory /var/www/>
        Options FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Require all granted
    </Directory>

.htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Admin in wp_usermeta Table:

wp_capabilities
a:1:{s:13:"administrator";s:1:"1";}

So login is ok.
Edit post is working
PROBELM:
New post has ‘submit for review’ button instaed of ‘publish’!

Clicking ‘submit for review’ gives ‘you do not have suitable permissions to edit the post’

And I can’t seem to find the problem.
I tried fixing file and folder permissions.
Adding define(‘WP_HOME’ AND define(‘WP_SITEURL’ to wp-config

I dont even know where to start…

wp_posts table has A_I on ID.
wp_posts DUMP shows:

--
-- AUTO_INCREMENT for table `wp_posts`
--
ALTER TABLE `wp_posts`
MODIFY `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7633;

7633 is the next post ID.

How can I fix this??
Please ask any question as I have been through most of the fixes suggested on the web.

ThanX 🙂

Related posts

Leave a Reply

3 comments

  1. Migration means environment change

    What’s in your environment? Mysql for one!

    Given that there’s a migration involved, I bet it’s something to do with your DB… you may be able to check logs to figure out what queries are failing. For me it was sql_mode, specifically related to 0s in date times not being accepted. (happens on new post drafts).

    Keep reading to solve the sql_mode, if that’s your issue.

    Check your sql_mode

    To check what your current sql_mode is, you can do this in mysql (probably as a root mysql user): SELECT @@sql_mode;

    WordPress uses 0s for “null” date times, and some sql mode settings do not allow that. I believe there are plugins out there that try to solve this 0s for dates problem at the application layer (within wordpress), but I think that may be a bit hacky…

    I opted to switch my sql_mode and made my sql mode only NO_ENGINE_SUBSTITUTION because wordpress is the only thing using my database and I’m okay with that sql_mode for my project. You may need to preserve most of the settings in your sql_mode setting, but just remove the no zero in date option, so that’s why you should check what your current sql_mode is before resetting it.

    What are the sql_modes by default?

    The default SQL mode in MySQL 5.7 includes these modes: ONLY_FULL_GROUP_BY, STRICT_TRANS_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, and NO_ENGINE_SUBSTITUTION.

    So, you may want to remove NO_ZERO_IN_DATE, NO_ZERO_DATE from yours if you find it present, and preserve the rest.

    Where do I change my sql mode?

    To set the SQL mode at server startup, use the –sql-mode=”modes”
    option on the command line, or sql-mode=”modes” in an option file such
    as my.cnf (Unix operating systems) or my.ini (Windows). modes is a
    list of different modes separated by commas. To clear the SQL mode
    explicitly, set it to an empty string using –sql-mode=”” on the
    command line, or sql-mode=”” in an option file.

    I set mine in options.cnf or my.cnf on my server for the mysql program.

  2. Solution

    Define a new admin user

    Log in with that admin user

    Lower your previous admin to contributor

    Increase it back to administrator

    Log in with your original admin

    It will now work.

    Delete the new admin

    Now it’s back to normal.

  3. The only solution I could find which did the trick, after many different other solutions out there was to install a fresh copy of WordPress4.0.1 and that fixed everything.