Wordpress Tutorials
- Wordpress
- Directory and file structure.
- Wordpress configuration
- Htaccess Configuration
- WP-CONTENT user playground
- Increase file size loading in phpmyadmin on localhost.
- Fatal error: Allowed memory size of x bytes
- wordpress Dashboard
- How to set local host domain or Virtual host
- Header, index and footer page.
- How to create wordpress Themes
- Html to wordpress themes
- Child Themes
- Increase Upload Max Filesize
- wp_enqueue_style & script
- How to make plugin
- Create Plugin
- Insert data into table using plugin.
- Show data from database
- Hook & Filter
- Template Or Custom page template
- Custom Login template
- How to show post on diffrent page.
- Custom widgit
- How to use contact form 7 plugin.
- Wordpress Database
- How to use Duplicator plugin
- How to fix Fatal Error: Maximum Execution Time Exceeded in WordPress
- How to debuggin mode on in wordpress
- Auto update plugin and themes
- How to Transfer WordPress
- How to change a WordPress site URL
- Top 10 issues in wordpress
- wordpress website link
Wordpress setting
Wordpress Function
wordpress top 10 problems
Important Links
WORDPRESS CONFIGURATION
This section covers database connections, storing FTP info, enabling debugging tools, and more using wp-config.php. It also covers the power of the .htaccess fi le, including increasing PHP memory limits and max upload sizes, creating redirects, and setting access restrictions.
wp-confi g.php File
The most important fi le in any WordPress installation is the wp-config.php fi le. This fi le contains all database connection settings, including the database name, username, and password to access your MySQL database. This fi le also stores additional database and other advanced settings. The wp-config.php fi le was originally named wp-config-sample.php. Renaming the fi le to wp-config.php is one of the fi rst steps to installing WordPress. The wp-config fi le is typically stored in the root directory of WordPress.
Alternatively, you can
move the wp-config fi le out of the WordPress root directory and into the parent directory. So if
your WordPress directory is located here,
/public_html/my_website/wp-config.php
you can safely move the fi le to here:
/public_html/wp-config.php
WordPress looks for the wp-config fi le in the root directory fi rst, and if it can’t fi nd that fi le it
looks in the parent directory. This happens automatically so no settings need to be changed for this
to work.
NOTE Moving the wp-config.php out of the root WordPress directory is a good
security measure, making it nearly impossible to potentially access this fi le from
a web browser.
Some options in WordPress are stored as constants and these can be seen in the wp-config.php fi le.
The constraints all have the same format:
define( 'OPTION_NAME', 'value' );
OPTION_NAME is the name of the option constant being set; value is the option value and can be
updated to whatever setting you would like to save for that option. When adding new options to the
wp-config.php fi le, it’s important the options are added above the line that reads:
/* That's all, stop editing! Happy blogging. */
Debugging option :-
Debugging errors in WordPress can be made easier using the WP_DEBUG option. Enabling WP_DEBUG displays WordPress errors on the screen, rather than suppressing those errors with a white screen. To enable WP_DEBUG, just set the option value to true: define( 'WP_DEBUG', true ); New installations of WordPress will have this option defi ned in wp-config as false. If this option is not defi ned, it defaults to false and error messages are not displayed. Remember to disable or remove this option when you are done debugging because error messages might help hackers fi nd vulnerabilities in your website. It’s best to always keep WP_DEBUG enabled when developing in WordPress to address any warnings or errors that might be displayed.
Advanced wp-confi g Options
You can set additional advanced options in your wp-config fi le. These options are not in the
wp-config fi le by default so you will need to manually add them to the fi le.
To set your WordPress address and blog address, use the following two options:
The WP_SITEURL option allows you to temporarily change the WordPress site URL. This does not alter the database option value for siteurl, but instead temporarily changes the value. If this option is removed, WordPress reverts back to using the siteurl database setting. The WP_HOME option works the exact same way, letting you temporarily change the home value for WordPress. Both values should include the full URL including http://.
an option that allows you to move the wp-content directory. The two
required options are:
define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] .
'/wordpress/blog/wp-content' );
define( 'WP_CONTENT_URL', 'http://domain.com/wordpress/blog/wp-content');
The WP_CONTENT_DIR option value is the full local path to your wp-content directory. The
WP_CONTENT_URL is the full URI of this directory. Optionally, you can set the path to your plugins
directory like so:
define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' );
define( 'WP_PLUGIN_URL', 'http://example/blog/wp-content/plugins');
WP_PLUGIN_DIR and WP_PLUGIN_URL are options used by plugin developers to determine
where your plugin folder resides. If a plugin developer is not using these constants, there is a very
good chance their plugin will break if you move your wp-content directory. Never move the
wp-content directory on your production server without fi rst testing in a development
environment.
WP_POST_REVISIONS :-
WordPress has a built-in post revisions option called WP_POST_REVISIONS. You can set this option to false to completely disable post revisions altogether, or you can specify a maximum number of revisions to keep
for each post or page. Following are examples of both scenarios:
define( 'WP_POST_REVISIONS', false );
define( 'WP_POST_REVISIONS', 5 );
You can also confi gure the auto-save interval by setting the AUTOSAVE_INTERVAL option.
WordPress uses AJAX when editing a post to auto-save revisions. By default, this interval is 60 seconds. You can set the interval in seconds for auto-save in wp-config. Set auto-save to
5 minutes by using this code:
define( 'AUTOSAVE_INTERVAL', 300 );
File name : index.php
Enable logging file for display error.
You can also enable logging directly from your wp-config fi le. To enable logging, fi rst you need to
create a php_error.log fi le and upload it to your root WordPress directory. Then simply turn on
the log_errors PHP option and point to your logging fi le:
@ini_set( 'log_errors','On' );
@ini_set( 'display_errors','Off' );
@ini_set( 'error_log','/public_html/wordpress/php_error.log' );
All errors will now be logged to this fi le.
WP_MEMORY_LIMIT :-
If
your website hits the memory limit set for WordPress to run, you will see the error “Allowed memory
size of xxxxx bytes exhausted.” Increasing the memory limit fi xes this problem. The memory limit is
set by defi ning the megabytes needed:
define( 'WP_MEMORY_LIMIT', '32M' );
WP_CACHE :
The WP_CACHE option is required for some caching plugins to work. Enabling this option will include the fi le wp-content/advanced-cache.php. To enable this option use the following code: define( 'WP_CACHE', true );
crown job
There is also an option to disable WordPress cron. Cron is used to execute scheduled tasks in
WordPress. Some common schedule tasks include posting a scheduled post and checking for new
versions of WordPress, themes, and plugins. To disable WordPress cron add this option to your
wp-config fi le:
define( 'DISABLE_WP_CRON', true );
File name : index.php