I wrote a series of bash scripts that use git to push my files, wp-cli to export/import my dbs, and rsync to upload/download dbs, and wp-cli to search-replace usernames & urls between test, staging, and prod.
The scripts work as expected on 27 out of 28 websites.. push/pull no problems However for one website, following a completely successful error free push. the admin user looses the admin role.
My question is not about the scripts. The scripts work.
Question:
What are the wordpress that settings that I can check/verify/adjust prior to migration that may prevent the administrator
role from being stripped from my Admin User upon migration?
Another odd behavior
Admin role stripping.... is not specific to a single admin user. If I migrate from test to staging, all admin users currently on staging, will be stripped of their admin role.
Example:
Before Migration Staging Server has this admin user in wp_capabilities:
While Test server has this admin user in wp_capabilities:
Following migration from test to staging...Admin user loses admin privileges and STAGING wp_capabilities now has the test server's user id (11 instead of 2):
Meanwhile wp user list
still shows the user id as 2.
Confusion
As I am excluding the users / users_meta tables from my db import/exports workflow, I don't understand how this behavior is possible. The admin user info is not moved between servers.
My export command:
Additional Notes
1.) In my workflow, I exclude the user / usermeta when I export the db? Could my staging server be missing important info from these tables and therefore be the stripping admin privileges?
2.) This site was previously a subsite of a multisite, so I was careful to replace the nickname
for the current admin. And wp_capabilities
verifies that the sole user (admin) has an admin role: a:9:{s:13:"administrator";a:2:
3.) When I activate the debug.log
on staging all I get are php warnings, deprecation messages, and notices. No errors.