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:
Delay loading Google AdSense
Replace: “ca-pub-0000000000000000” – with your own ID. 3000 – with desired time (3000 – 3 seconds)
Use multiple Google Analytics trackers on one page
1. In the same block of code Plugins “linkid” and “displayfeatures” in below code are as example only. You can remove that lines from your code. 2. In separate blocks of JS and
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`, […]
Embed “Advanced Custom Fields PRO” (ACF PRO) plugin in your own WordPress plugin
If you want to distribute you own paid WorPress plugin with “Advanced Custom Fields PRO” embedded: Create in your plugin folder “acf” Upload there ACF PRO files Use below code in your plugin to change path, dir and include ACF PRO:
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 […]
Replace data in serialized string
Here you can replace some strings into other with proper length recalculation within serialized string:
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: