常用的WordPress wp-config.php 命令

主题插件和高阶开发
浏览次数 584

WordPress Constants

Use the following constants to manage important settings of your WordPress installation in the wp-config.php file. Learn more about here.

Info

Example

WP Language: define( ‘WPLANG’, ‘de_DE’ );
WP Force SSL Admin: define( ‘FORCE_SSL_ADMIN’, true );
WP PHP Memory Limit: define( ‘WP_MEMORY_LIMIT’, ’64M’ );
WP PHP Max Memory Limit: define( ‘WP_MAX_MEMORY_LIMIT’, ‘256M’ );
WP Post Revisions: define( ‘WP_POST_REVISIONS’, false );
WP Autosave Interval: define( ‘AUTOSAVE_INTERVAL’, 160 );
WP Mail Interval: define( ‘WP_MAIL_INTERVAL’, 60 );
WP Empty Trash: define( ‘EMPTY_TRASH_DAYS’, 30 );
WP Media Trash: define( ‘MEDIA_TRASH’, true );
WP Cleanup Image Edits: define( ‘IMAGE_EDIT_OVERWRITE’, true );
WP Multisite: define( ‘WP_ALLOW_MULTISITE’, true );
WP Main Site Domain: define( ‘DOMAIN_CURRENT_SITE’, ‘www.domain.com‘ );
WP Main Site Path: define( ‘PATH_CURRENT_SITE’, ‘/path/to/wordpress/’ );
WP Main Site ID: define( ‘SITE_ID_CURRENT_SITE’, 1 );
WP Main Site Blog ID: define( ‘BLOG_ID_CURRENT_SITE’, 1 );
WP Allow Subdomain Install: define( ‘SUBDOMAIN_INSTALL’, true );
WP Allow Subdirectory Install: define( ‘ALLOW_SUBDIRECTORY_INSTALL’, true );
WP Site Specific Upload Directory: define( ‘BLOGUPLOADDIR’, ” );
WP Upload Base Directory: define( ‘UPLOADBLOGSDIR’, ‘wp-content/blogs.dir’ );
WP Load Sunrise: define( ‘SUNRISE’, true );
WP Debug Mode: define( ‘WP_DEBUG’, true );
WP Debug Log: define( ‘WP_DEBUG_LOG’, true );
WP Debug Display: define( ‘WP_DEBUG_DISPLAY’, true );
WP Script Debug: define( ‘SCRIPT_DEBUG’, true );
WP Save Queries: define( ‘SAVEQUERIES’, true );
WP Automatic Updates: define( ‘AUTOMATIC_UPDATER_DISABLED’, true );
WP Core Updates: define( ‘WP_AUTO_UPDATE_CORE’, false );
WP Default Theme Updates: define( ‘CORE_UPGRADE_SKIP_NEW_BUNDLED’, true );
WP Plugin and Theme Editor: define( ‘DISALLOW_FILE_EDIT’, true );
WP Plugin and Theme Updates: define( ‘DISALLOW_FILE_MODS’, true );
WP Default Theme: define( ‘WP_DEFAULT_THEME’, ‘default-theme-folder-name’ );
WP Alternate Cron: define( ‘ALTERNATE_WP_CRON’, true );
WP Cron: define( ‘DISABLE_WP_CRON’, true );
WP Cron Lock Timeout: define( ‘WP_CRON_LOCK_TIMEOUT’, 60 );
WP Cache: define( ‘WP_CACHE’, true );
WP Concatenate Admin JS/CSS: define( ‘CONCATENATE_SCRIPTS’, false );
WP Compress Admin JS: define( ‘COMPRESS_SCRIPTS’, false );
WP Compress Admin CSS: define( ‘COMPRESS_CSS’, false );
WP Enforce GZip Admin JS/CSS: define( ‘ENFORCE_GZIP’, true );
WP Allow unfiltered HTML: define( ‘DISALLOW_UNFILTERED_HTML’, true );
WP Allow unfiltered Uploads: define( ‘ALLOW_UNFILTERED_UPLOADS’, true );
WP Block External URL Requests: define( ‘WP_HTTP_BLOCK_EXTERNAL’, true );
WP Redirect Nonexistent Blogs: define( ‘NOBLOGREDIRECT’, ‘http://example.com‘ );
WP Cookie Domain: define( ‘COOKIE_DOMAIN’, ‘www.example.com‘ );
WP Cookie Hash: define( ‘COOKIEHASH’, ” );
WP Auth Cookie: define( ‘AUTH_COOKIE’, ” );
WP Secure Auth Cookie: define( ‘SECURE_AUTH_COOKIE’, ” );
WP Cookie Path: define( ‘COOKIEPATH’, ” );
WP Site Cookie Path: define( ‘SITECOOKIEPATH’, ” );
WP Admin Cookie Path: define( ‘ADMIN_COOKIE_PATH’, ” );
WP Plugins Cookie Path: define( ‘PLUGINS_COOKIE_PATH’, ” );
WP Logged In Cookie: define( ‘LOGGED_IN_COOKIE’, ” );
WP Test Cookie: define( ‘TEST_COOKIE’, ” );
WP User Cookie: define( ‘USER_COOKIE’, ” );
WP Directory Permission: define( ‘FS_CHMOD_DIR’, ( 0755 & ~ umask() ) );
WP File Permission: define( ‘FS_CHMOD_FILE’, ( 0644 & ~ umask() ) );
WP FTP Method: define( ‘FS_METHOD’, ‘ftpext’ );
WP FTP Base: define( ‘FTP_BASE’, ‘/path/to/wordpress/’ );
WP FTP Content Dir: define( ‘FTP_CONTENT_DIR’, ‘/path/to/wordpress/wp-content/’ );
WP FTP Plugin Dir: define( ‘FTP_PLUGIN_DIR ‘, ‘/path/to/wordpress/wp-content/plugins/’ );
WP SSH Public Key: define( ‘FTP_PUBKEY’, ‘/home/username/.ssh/id_rsa.pub’ );
WP SSH Private Key: define( ‘FTP_PRIKEY’, ‘/home/username/.ssh/id_rsa’ );
WP FTP Username: define( ‘FTP_USER’, ‘username’ );
WP FTP Password: define( ‘FTP_PASS’, ‘password’ );
WP FTP Host: define( ‘FTP_HOST’, ‘ftp.example.org‘ );
WP FTP SSL: define( ‘FTP_SSL’, false );
WP Site URL: define( ‘WP_SITEURL’, ‘http://example.com/wordpress‘ );
WP Home: define( ‘WP_HOME’, ‘http://example.com‘ );
WP Uploads Path: define( ‘UPLOADS’, dirname(__FILE__) . ‘wp-content/media’ );
WP Template Path: define( ‘TEMPLATEPATH’, dirname(__FILE__) . ‘wp-content/themes/theme-folder’ );
WP Stylesheet Path: define( ‘STYLESHEETPATH’, dirname(__FILE__) . ‘wp-content/themes/theme-folder’ );
WP Content Path: define( ‘WP_CONTENT_DIR’, dirname(__FILE__) . ‘/blog/wp-content’ );
WP Content URL: define( ‘WP_CONTENT_URL’, ‘http://example/blog/wp-content‘ );
WP Plugin Path: define( ‘WP_PLUGIN_DIR’, dirname(__FILE__) . ‘/blog/wp-content/plugins’ );
WP Plugin URL: define( ‘WP_PLUGIN_URL’, ‘http://example/blog/wp-content/plugins‘ );
WP Language Path: define( ‘WP_LANG_DIR’, dirname(__FILE__) . ‘/wordpress/languages’ );
WP Temporary Files Path: define( ‘WP_TEMP_DIR’, dirname(__FILE__) . ‘wp-content/temp’ );

Database

Use the following constants to manage important database settings of your WordPress installation in the wp-config.php file. Learn more about here.

Info Result Example
数据库版本: 8.0.16
DB Name: local define( ‘DB_NAME’, ‘MyDatabaseName’ );
DB User: root define( ‘DB_USER’, ‘MyUserName’ );
DB Host: localhost define( ‘DB_HOST’, ‘MyDatabaseHost’ );
DB Password: *** define( ‘DB_PASSWORD’, ‘MyPassWord’ );
DB Charset: utf8 define( ‘DB_CHARSET’, ‘utf8’ );
DB Collate: Not defined define( ‘DB_COLLATE’, ‘utf8_general_ci’ );
WP Allow DB Repair: Disabled define( ‘WP_ALLOW_REPAIR’, true );
WP Disallow Upgrade Global Tables: Disabled define( ‘DO_NOT_UPGRADE_GLOBAL_TABLES’, true );
WP Custom User Table: Not defined define( ‘CUSTOM_USER_TABLE’, $table_prefix.’my_users’ );
WP Custom User Meta Table: Not defined define( ‘CUSTOM_USER_META_TABLE’, $table_prefix.’my_usermeta’ );
WP Display Database Errors: Disabled define( ‘DIEONDBERROR’, true );
WP Database Error Log File: Not defined define( ‘ERRORLOGFILE’, ‘/absolute-path-to-file/’ );
Table Prefix: wp_
Table Base Prefix: wp_ (defined)

Security Keys

Use the following constants to set the security keys for your WordPress installation in the wp-config.php file. Learn more about here.

Info Result Example
WP Auth Key: Defined define( ‘AUTH_KEY’, ‘MyKey’ );
WP Secure Auth Key: Defined define( ‘SECURE_AUTH_KEY’, ‘MyKey’ );
WP Logged In Key: Defined define( ‘LOGGED_IN_KEY’, ‘MyKey’ );
WP Nonce Key: Defined define( ‘NONCE_KEY’, ‘MyKey’ );
WP Auth Salt: Defined define( ‘AUTH_SALT’, ‘MyKey’ );
WP Secure Auth Salt: Defined define( ‘SECURE_AUTH_SALT’, ‘MyKey’ );
WP Logged In Auth Salt: Defined define( ‘LOGGED_IN_SALT’, ‘MyKey’ );
WP Nonce Salt: Defined define( ‘NONCE_SALT’, ‘MyKey’ );
上一篇
form redirect
下一篇
网站素材,图片怎么准备?
我们将在15分钟内联系你

提供行业网站方案以及海外推广计划