Allow only user administrator within plugin

It you want to restrict some code in your plugin within WP Admin only for “administrator”, you can’t just use “current_user_can()” as this function is defined after running plugin code. You need to execute your code only when “current_user_can()” is available:

Add new Admin User for WordPress directly in database

If you have no access to “/wp-admin” area of your WordPress: Connect to the database or PHPMyAdmin or console: mysql -uUSER -pPASS -hmysql DB; Copy the following code and modify the appropriate fields INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES (‘<username>’, MD5(‘<password>’), ‘<full_name>’, ‘<email_address>’, ‘0’);SET @newUserId = LAST_INSERT_ID();INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, […]

WP Admin custom column

/* * Add columns to exhibition post list */ public function add_acf_columns ( $columns ) { return array_merge ( $columns, array ( ‘start_date’ => __ ( ‘Starts’ ), ‘end_date’ => __ ( ‘Ends’ ) ) ); } add_filter ( ‘manage_exhibition_posts_columns’, ‘add_acf_columns’ );       /* * Add columns to exhibition post list */ public […]

Convert to MD5

Here you can convert any string to MD5 (message-digest algorithm) cryptographic hash function, producing a 128-bit (16-byte) 32-digit hexadecimal number: