General Wordpress Flashcards
If you were to change the WP table prefix in wp-config.php, would this update the existing tables or create new ones?
Creates new ones - you effectively end up with a clean installation.
What are the three main directories that appear in a default WP instalation?
wp-content
wp-admin
wp-includes
The core files are mainly where?
Most of the root directory, wp-admin and wp-includes
Where do all the custom files (content) go?
wp-content
What is one of the major disadvantages of editing core files in WP?
Updating the software version will overwrite the changes
What file contains all of the database configuration information?
wp-config.php
What is one easy security measure to implement with regards to wp-config.php?
Move it to higher than the root directory of the website. So…
myhost/public_html/wordpresssite/wp-config.php
myhost/public_html/wp-config.php
No config changes need to be done, as wordpress checks the root for the file first.
If you need to add a new option / constant to WP - what file would you at that in?
wp-config.php
What line in wp-config.php should you not edit past?
/* That’s all, stop editing! Happy blogging. */
What is another simple way to improve security in Wordpress?
Change the security keys (they are hashing salts) in wp-config.php
Changing the security keys at any time will have what effect?
It will simply require users to have to log in-again (it effectively invalidates the existing cookies).
How does changing the default wordpress table prefix ($table_prefix in wp-config.php) help with security.
If someone attempts an sql injection attack, it makes it a lot harder for them to guess the table names.
What setting would you enable to turn on debugging in WP?
WP_DEBUG in the wp-config.php file.
What is the purpose of WP_SITEURL in wp-config.php?
It overrides the setting for SITE URL in the wp installation database. (NOTE - this is temporary and will stop working if it is removed from the file (reverting back to the database setting)
What define would you use to configure a new place for the site content?
define(‘WP_CONTENT_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/wordpress/blog/wp-content’);
define(‘WP_CONTENT_URL’, ‘http://domain.com/wordpress/blog/wp-content’);
What constant would you use to configure a new place for plugins?
define(‘WP_PLUGIN_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/wordpress/blog/wp-content/plugins’);
define(‘WP_PLUGIN_URL’, ‘http://domain.com/wordpress/blog/wp-content/plugins’);
When developing plugins, why should you use the WP_PLUGIN_DIR and WP_CONTENT_DIR constants?
Because a user may configure their site differently, and if the folders are moved, it will break the plugin.
Adding post revisions (i.e. updating and revising posts) can add a huge overhead to the database, how do you prevent this from happening?
You can eitehr disable post revisions:
define(‘WP_POST_REVISIONS’, false);
or set a limit
define(‘WP_POST_REVISIONS’, 5);
Wordpress uses AJAX to implement autosaves on posts - how can you configure this?
define(‘AUTOSAVE_INTERVAL’, 300);
What is a good WP debug option for determine what is going wrong with a query?
define(‘SAVEQUERIES’, true);
saves all queries to an array for display.
to display them:
if (current_user_can(‘manage_options’)) {
global $wpdb;
print_r($wpdb->queries);
}
// NOTE This use of global means we are accessing a globally declared variable named $wpdb - that is outside the scope of this function.
How do you enable logging in wordpress.
Create a php_error.log file and place it in the root WP directory. Then set the following options in wp-config.php
@ini_set(‘log_errors’, ‘on’);
@ini_set(‘display_errors’, ‘off’);
@ini_set(‘error_log’, ‘/public_html/wordpress/php_error.log’);
The error_log value (when specifying location) is relative to…
the web server document root, not the wordpress installation root.
How do you increase the allowable memory limit of a wordpress installation?
define(‘WP_MEMORY_LIMIT’, ‘32M’);
Only if the hosting site allows it though!!
How do you specify the default language for the site?
define(‘WPLANG’, ‘en-GB’);
Gives english, great britain