Set WordPress to empty the trash automatically after a number of days.
define( 'EMPTY_TRASH_DAYS', 30 );
Change the Autosave Interval for your posts, pages, etc.
Set the seconds that you would like to have your content saved while you are editing it.
define( 'AUTOSAVE_INTERVAL', 160 );
Limit posts revisions. Or disable them with setting it to false.
define( 'WP_POST_REVISIONS', 3 );
Enable the Debug mode without displaying it on your pages.
These lines will save the error log into debug.log file in your wp-content/ directory.
define('WP_DEBUG', true); define('WP_DEBUG_DISPLAY', false); define('WP_DEBUG_LOG', true);
The following lines are already in the wp-config.php file, and you should always change the default values.
A way to do this is going to https://api.wordpress.org/secret-key/1.1/salt/ and replace the default values with the ones given.
define('AUTH_KEY', 'put your unique phrase here'); define('SECURE_AUTH_KEY', 'put your unique phrase here'); define('LOGGED_IN_KEY', 'put your unique phrase here'); define('NONCE_KEY', 'put your unique phrase here'); define('AUTH_SALT', 'put your unique phrase here'); define('SECURE_AUTH_SALT', 'put your unique phrase here'); define('LOGGED_IN_SALT', 'put your unique phrase here'); define('NONCE_SALT', 'put your unique phrase here');
Enable Multisite functionality.
define( 'WP_ALLOW_MULTISITE', true );
Define the Site URL address.
define('WP_HOME', 'http://www.wptips.me'); define('WP_SITEURL', 'http://www.wptis.me');
Override file permissions.
define('FS_CHMOD_FILE', 0755); define('FS_CHMOD_DIR', 0644);
You can set Automatic Database Optimizing. If a database is corrupt normally the user isn’t able to login so to run this script the user doesn’t need to be logged in. It’s recommended to delete this line after you repair your database.
After including the line in your wp-config.php the script can be found at http://your_domain/wp-admin/maint/repair.php
define( 'WP_ALLOW_REPAIR', true );
You can increase your PHP memory limit (won’t work with all hosts).
Define custom user tables.
define('CUSTOM_USER_TABLE', $table_prefix.'custom_users'); define('CUSTOM_USER_META_TABLE', $table_prefix.'custom_usermeta');
Disable plugin and themes editors:
define( 'DISALLOW_FILE_EDIT', true );
Change the wp-content directory name and location:
define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/some-folder/site-content' ); define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/some-folder/site-content';
Save the database queries to an array stored in the global $wpdb->queries.
This will have a performance impact on your site, turn off when not debugging.
And don’t forget to protect your wp-config.php through the .htaccess file:
1 2 3 4 5
<Files wp-config.php> order allow,deny deny from all </Files>
For more advanced use of wp-config.php visit http://codex.wordpress.org/Editing_wp-config.php
This is one of those simple but very useful plugins. It’s a time saver.
With this plugin, as you have guessed already by it’s name, you can duplicate a menu to add it anywhere else on your website.
So imagine you have a really huge (or not as huge) menu on your top navigation and you would like to add the same navigation to your footer. You will be able to do that in a few clicks with this plugin, otherwise you would have to manually create the menu, add the pages (or whatever you want to add) one by one. So this plugin will save you a ton of time.
Check it out on the wordpress.org repository http://wordpress.org/plugins/duplicate-menu/
After installing it just go to Appearance -> Duplicate menu.
Duplicate your menu, and then go to Appearance -> Menus, and you will see your new menu in the list.
If you need to set the featured images for all of your old posts, checkout this plugin, Set All First Images As Featured will do the job for you.
You can choose on what post type you want to run the plugin (posts, pages, etc), options to choose between dates, and you can also overwrite the existing featured images.
The plugin will look for the first attached image to a post, and if it can’t find it it will look for the first html image tag in the post and get the src attribute, this will only work if the image is on the same server as the website.
And don’t forget, when you run this plugin or any other plugin that makes any changes on you database make sure to do a backup first.
The WordPress Importer plugin does not import images when you import separately posts, pages, …. Even importing it all together does not work 100% correctly, it leaves the images in the content linked to the old site and does not keep the featured images.
This plugin has options to import the external images and save the first image found as featured image, the problem is that this last option does not work very well, so it is not worth using this plugin for setting the featured images but only to import external images.
After importing the XML file of the WordPress export, run Media Tools, it will trace the posts looking for src attributes of images found, if these do not exist on the new website, the plugin will upload them to the new uploads folder and update the src attribute of images to the new location.
1. Export posts or pages from the old site. Tools -> Export.
2. Install WordPress Importer in the new site where you will import the exported file.
3. Tools -> Import, select the file. Assign the authors of the posts and check “Download and import file attachments”, this box is to download and import attachments, but as I said before, it will not download or import, it just adds the url’s of the images in the posts and will continue pointing to the old site.
4. Install the Media Tools plugin, activate it, go to Tools -> Media Tools.
Select the option to import external images. Select the post type where it must perform the tracing (posts, pages, etc.) and click the button below to start the process (as I said before, the option to assign featured images does not work properly so it’s better ignore this option for the moment).
5. The progress bar will display and just below a log of the traced posts with the found and imported images. When the bar reaches 100% the process is complete.
To set the first image as featured.
Install the plugin Set All First Images As Featured
This plugin will scan looking for images attached to the post and save the first image found as featured. If it doesn’t find any images attached to the post it will look for src attribute of the first <img> tag in the content of the post, if it finds an image it will save it as the featured one.
Before running this plugin (and generally any plugin that modifies your database) is recommended to do a backup of the database (and in this case specifically the tables postmeta and posts)
Brad Touesnard wrote a post on how to ignore errors on third party plugins while you are developing on debug mode.
On this post he shares very good tips on how to do this on command line so you don’t need to be opening the error log file constantly, have the errors filtered to ignore those we don’t want to see and output theme directly on the terminal window.
Check out the post here http://bradt.ca/blog/ignoring-errors-wordpress-debug-mode/
A bit more anvanced
You can also find scripts to be able to manage multiple plugins from the same script.
Check out the post of Ronakg Gandhi about auto updating plugins not hosted by wordpress.org, where he shares a script to add to your plugins.
The script originally is from Kaspars, but Ronakg added some features to it.
You can download it from github:
This is a quick tip, always create a specific ( even if it’s one file ) plugin to add your custom functions, like mySite-functionality.php instead of writing all in the theme functions.php file.
The reason is that if you change your theme tomorrow you will not lose all of the functionality added to your site.
Obviously you can do a copy/paste of all the functions, but I think it’s a better practice to have you own little plugin for that purpose.
Usefull post published by wpmudev with the 9 most common WordPress problems and their possible solutions.
- 500 Internal Server Error
- White Screen of Death
- Maintenance Mode Error
- Error Establishing A Database Connection
- Connection Timed Out
- Error 145 ( WordPress database is damaged or corrupted )
- Error 28 ( MySQL error not related to WordPress)
- Warning: Cannot Modify Header Information — Headers Already Sent
- Warning: File_Get_Contents
This is the link to the post:
Very complete article in wphub.com with tips to export and import , from the default WordPress import/export functionality, to a long list of plugins for that matter, and also included script to import to MySQL database from Excel or CSV.
I haven’t really tested all of it, but I think it’s worth to check this out when you need to do this kind of work.