{"id":1000,"date":"2024-01-16T19:38:00","date_gmt":"2024-01-16T19:38:00","guid":{"rendered":"http:\/\/musilda.cz\/?p=1000"},"modified":"2024-01-16T19:38:00","modified_gmt":"2024-01-16T19:38:00","slug":"10-tipu-pro-wp-config","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/10-tipu-pro-wp-config\/","title":{"rendered":"10+ tip\u016f pro wp-config"},"content":{"rendered":"\n

Aktualizov\u00e1no 16. ledna 2024<\/em><\/p>\n\n\n\n

Pokud jste ji\u017e n\u011bkdy instalovali WordPress, ur\u010dit\u011b zn\u00e1te soubor wp-config.php. Najdete v n\u011bm definovan\u00e9 p\u0159ipojen\u00ed k datab\u00e1zi, jazykovou verzi WordPressu a n\u011bkolik dal\u0161\u00edch nastaven\u00ed. Vy ale m\u016f\u017eete pomoc\u00ed wp-config.php definovat daleko v\u00edce parametr\u016f, ne\u017e jen ty, kter\u00e9 v n\u011bm naleznete po instalaci. Tento \u010dl\u00e1nek v\u00e1m p\u0159in\u00e1\u0161\u00ed tipy na n\u011bkter\u00e9 z nich.<\/p>\n\n\n\n\n\n\n\n

Ulo\u017een\u00ed FTP \u00fadaj\u016f pro instalaci WordPressu<\/h2>\n\n\n\n

Definujte FTP p\u0159ipojen\u00ed pro WordPress a nebudete ji\u017e \u017e\u00e1d\u00e1ni p\u0159i aktualizaci o p\u0159ihla\u0161ovac\u00ed \u00fadaje pro FTP \u00fa\u010det:<\/p>\n\n\n\n

define('FTP_HOST', 'ftp.yoursite.com');\ndefine('FTP_USER', 'Your_FTP_Username');\ndefine('FTP_PASS', 'Your_FTP_password');\ndefine('FTP_SSL', true); \/\/ true nastavte, pokud budete vyu\u017e\u00edvat SSL<\/code><\/pre>\n\n\n\n

Znemo\u017en\u011bn\u00ed editace php soubor\u016f \u0161ablon a plugin\u016f<\/h2>\n\n\n\n

Mo\u017enost editov\u00e1n\u00ed soubor\u016f \u0161ablony, nebo plugin\u016f p\u0159\u00edmo v editoru je jist\u011b super v\u011bc, ale pokud d\u011bl\u00e1te web pro klienta, ur\u010dit\u011b nebudete cht\u00edt, aby v\u00e1m p\u0159episoval soubory.<\/p>\n\n\n\n

define('DISALLOW_FILE_EDIT', true); \/\/zak\u00e1\u017ee u\u017eivatel\u016fm editovat soubory \u0161ablon a plugin\u016f\ndefine('DISALLOW_FILE_MODS', true); \/\/zak\u00e1\u017ee u\u017eivatel\u016fm aktualizovat WP, pluginy nebo t\u00e9mata\ndefine('IMAGE_EDIT_OVERWRITE', true) \/\/pokud nastav\u00edme true, pak budou \u00fapravy obr\u00e1zk\u016f p\u0159episovat p\u016fvodn\u00ed soubory<\/code><\/pre>\n\n\n\n

Automatick\u00e9 vypr\u00e1zdn\u011bn\u00ed ko\u0161e<\/h2>\n\n\n\n

Pokud se na webu pohybuje v\u00edce redaktor\u016f, bude se v\u00e1m ur\u010dit\u011b hodit definice frekvence automatick\u00e9ho vysyp\u00e1n\u00ed ko\u0161e, d\u00edky \u010demu\u017e nebude zbyte\u010dn\u011b ko\u0161 zab\u00edrat m\u00edsto.<\/p>\n\n\n\n

define('EMPTY_TRASH_DAYS', 3); \/\/v tomto p\u0159\u00edpad\u011b se ko\u0161 vysype ka\u017ed\u00fd t\u0159et\u00ed den\ndefine( 'MEDIA_TRASH', false); \/\/Kdy\u017e je nastaveno na false: m\u00e9dia (nap\u0159. obr\u00e1zky) smazan\u00e1 u\u017eivateli nejsou p\u0159esunuta do ko\u0161e, ale jsou okam\u017eit\u011b a trvale odstran\u011bna<\/code><\/pre>\n\n\n\n

Nav\u00fd\u0161en\u00ed Memory Limit<\/h2>\n\n\n\n

Z\u00e1kladn\u00ed nastaven\u00ed Memory limitu je 32M(n\u011bkter\u00e9 hostingy maj\u00ed defaultn\u011b nastaveno 64MB), co\u017e m\u00e1 ob\u010das za n\u00e1sledek chybov\u00e9 hl\u00e1\u0161en\u00ed o nemo\u017enosti nahr\u00e1n\u00ed obr\u00e1zku.<\/p>\n\n\n\n

define('WP_MEMORY_LIMIT', '96M'); \/\/ nastavuje standartn\u00ed mno\u017estv\u00ed vyu\u017eiteln\u00e9 pam\u011bti\ndefine('WP_MAX_MEMORY_LIMIT', '512M'); \/\/ definuje maxim\u00e1ln\u00ed mno\u017estv\u00ed pam\u011bti, kterou m\u016f\u017ee WordPress vyu\u017e\u00edvat.<\/code><\/pre>\n\n\n\n

Aktivace debug m\u00f3du<\/h2>\n\n\n\n

Pokud vyv\u00fdj\u00edte plugin, nebo \u0161ablonu, bude se v\u00e1m ur\u010dit\u011b hodit mo\u017eno zapnout zobrazov\u00e1n\u00ed chybov\u00fdch hl\u00e1\u0161en\u00ed. Ostatn\u011b p\u0159i nahr\u00e1v\u00e1n\u00ed \u0161ablon do ofici\u00e1ln\u00edho reposit\u00e1\u0159e, je tato kontrola jednou z podm\u00ednek.<\/p>\n\n\n\n

define('WP_DEBUG', true); \/\/aktivace debuggov\u00e1n\u00ed\ndefine( 'WP_DEBUG_LOG', true ); \/\/chyby vypisuje do \/wp-content\/debug.log\ndefine( 'WP_DEBUG_LOG', '\/vlastni\/cesta\/debug.log'); \/\/vlastn\u00ed debug.log soubor\ndefine( 'WP_DEBUG_DISPLAY', true ); \/\/m\u016f\u017eeme vypnout, nebo zapnout zobrazov\u00e1n\u00ed chyb<\/code><\/pre>\n\n\n\n

Pokud m\u00e1te pouze jeden server, na kter\u00e9m hostujete v\u00fdvojov\u00e9 i produk\u010dn\u00ed str\u00e1nky, m\u016f\u017ee v\u00e1m n\u00e1sleduj\u00edc\u00ed konstanta velmi pomoct. Chcete-li zapnout v\u00fdvojov\u00e9 prost\u0159ed\u00ed, m\u016f\u017eete nastavit hodnotu WP_LOCAL_DEV na true:<\/p>\n\n\n\n

define( 'WP_LOCAL_DEV', true );<\/code><\/pre>\n\n\n\n

Frekvence automatick\u00e9ho ukl\u00e1d\u00e1n\u00ed<\/h2>\n\n\n\n

Pomoc\u00ed t\u00e9to definice m\u016f\u017eete upravit interval pro automatick\u00e9 ukl\u00e1d\u00e1n\u00ed obsahu v sekund\u00e1ch.<\/p>\n\n\n\n

define ('AUTOSAVE_INTERVAL', 180);<\/code><\/pre>\n\n\n\n

Zm\u011bna datab\u00e1zov\u00e9ho prefixu<\/h2>\n\n\n\n

V z\u00e1kladn\u00edm nastaven\u00ed je prefix pro datab\u00e1zov\u00e9 tabulky nastaven na wp_. Pomoc\u00ed t\u00e9to definice jej m\u016f\u017eete zm\u011bnit.<\/p>\n\n\n\n

$table_prefix  = 'moje_';<\/code><\/pre>\n\n\n\n

Zm\u011bna adresy blogu a adresy webu<\/h2>\n\n\n\n
define('WP_HOME', 'http:\/\/musilda.cz');\ndefine('WP_SITEURL', 'http:\/\/musilda.cz'); <\/code><\/pre>\n\n\n\n

Konfigurace error logu<\/h2>\n\n\n\n

Zapisov\u00e1n\u00ed chyb je velmi d\u016fle\u017eit\u00e1 mo\u017enost, jak zv\u00fd\u0161it kontrolu nad t\u00edm, co se na va\u0161em webu odehr\u00e1lo. Vytvo\u0159te sooubor php_error.log, um\u00edst\u011bte jej na server a nastavte jej pro zapisov\u00e1n\u00ed. Do wp-config.php vlo\u017ete n\u00e1sleduj\u00edc\u00ed k\u00f3d, kde v t\u0159et\u00edm \u0159\u00e1dku upravte path na va\u0161i cestu k souboru.<\/p>\n\n\n\n

@ini_set('log_errors','On');\n@ini_set('display_errors','Off');\n@ini_set('error_log','\/home\/path\/domain\/logs\/php_error.log');<\/code><\/pre>\n\n\n\n

Nastaven\u00ed jazykov\u00e9 varianty<\/h2>\n\n\n\n

Pokud pot\u0159ebujete zm\u011bnit jazyk va\u0161\u00ed WordPress instalace a z\u00e1rove\u0148 m\u016f\u017eete nastavit cestu ke slo\u017ece s jazykov\u00fdm souborem.<\/p>\n\n\n\n

define('WPLANG', '');\ndefine('LANGDIR', '');\n<\/pre>\n\n\n\n

Zablokov\u00e1n\u00ed extern\u00edch dotaz\u016f<\/h2>\n\n\n\n
define('WP_HTTP_BLOCK_EXTERNAL', true);<\/code><\/pre>\n\n\n\n

N\u011bkter\u00e9 pluginy v\u0161ak pro jejich spr\u00e1vnou funkci pot\u0159ebuj\u00ed m\u00edt external request povolen\u00fd. Pro jednotliv\u00e9 pluginy m\u016f\u017eete definovat vyj\u00edmku:<\/p>\n\n\n\n

define('WP_ACCESSIBLE_HOSTS', 'neco.cz');<\/code><\/pre>\n\n\n\n

Debugov\u00e1n\u00ed js a css<\/h2>\n\n\n\n

WordPress b\u011b\u017en\u011b na\u010d\u00edt\u00e1 minifikovan\u00e9 soubory. P\u0159i pou\u017eit\u00ed script debug se na\u010dtou origin\u00e1ln\u00ed soubory. Tento mechanismus pou\u017e\u00edv\u00e1 i \u0159ada \u0161ablon<\/a>.<\/p>\n\n\n\n

define( 'SCRIPT_DEBUG', true );<\/code><\/p>\n\n\n\n

Sn\u00ed\u017een\u00ed\/odstran\u011bn\u00ed reviz\u00ed<\/h2>\n\n\n\n

U ka\u017ed\u00e9ho p\u0159\u00edsp\u011bvku, nebo str\u00e1nky se b\u011bhem \u00faprav zvy\u0161uje po\u010det reviz\u00ed. Tyto revize slou\u017e\u00ed k uchov\u00e1n\u00ed historie zm\u011bn proveden\u00fdch na str\u00e1nk\u00e1ch. <\/p>\n\n\n\n

Revize mohou p\u0159i v\u011bt\u0161\u00edm mno\u017estv\u00ed zpomalovat datab\u00e1zi, proto si uk\u00e1\u017eeme, jak je omezit, nebo zcela odstranit.<\/p>\n\n\n\n

K\u00f3d pro zachov\u00e1n\u00ed libovoln\u00e9ho po\u010dtu reviz\u00ed(v tomto p\u0159\u00edpad\u011b 3):<\/p>\n\n\n\n

define('WP_POST_REVISIONS', 3);<\/code><\/pre>\n\n\n\n

K\u00f3d pro zak\u00e1z\u00e1n\u00ed reviz\u00ed:<\/p>\n\n\n\n

define('WP_POST_REVISIONS', false)<\/code><\/pre>\n\n\n\n

Konfigurace SSL certifik\u00e1tu<\/h2>\n\n\n\n

P\u0159ed pou\u017eit\u00edm n\u011bkter\u00e9ho z t\u011bchto nastaven\u00ed se ujist\u011bte, \u017ee V\u00e1\u0161 server podporuje SSL\/TLS, a \u017ee m\u00e1te spr\u00e1vn\u011b nastaven\u00fd certifik\u00e1t.<\/p>\n\n\n\n

define('FORCE_SSL_LOGIN', true); \/\/Zabezpe\u010duje proces registrace\/p\u0159ihl\u00e1\u0161en\u00ed\ndefine('FORCE_SSL_ADMIN', true); \/\/Vynucen\u00ed SSL pro administraci WP\n\r<\/code><\/pre>\n\n\n\n

Nastaven\u00ed spojen\u00e1 s datab\u00e1z\u00ed<\/h2>\n\n\n\n

P\u0159i po\u0161kozen\u00ed datab\u00e1ze je WordPress schopen jej\u00ed automatick\u00e9 n\u00e1pravy. Automatickou opravu datab\u00e1ze provedeme pomoc\u00ed n\u00e1sleduj\u00edc\u00edho k\u00f3du:<\/p>\n\n\n\n

define('WP_ALLOW_REPAIR', true);<\/code><\/pre>\n\n\n\n

Pokud chceme, aby WordPress automaticky neupgradoval tabulky, kter\u00e9 se t\u00fdkaj\u00ed glob\u00e1ln\u00edch funkc\u00ed, nastav\u00edme hodnotu n\u00e1sleduj\u00edc\u00edho k\u00f3du na true:<\/p>\n\n\n\n

define('DO_NOT_UPGRADE_GLOBAL_TABLES', true);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

Aktualizov\u00e1no 16. ledna 2024 Pokud jste ji\u017e n\u011bkdy instalovali WordPress, ur\u010dit\u011b zn\u00e1te soubor wp-config.php. Najdete v n\u011bm definovan\u00e9 p\u0159ipojen\u00ed k datab\u00e1zi, jazykovou verzi WordPressu a n\u011bkolik dal\u0161\u00edch nastaven\u00ed. Vy ale m\u016f\u017eete pomoc\u00ed wp-config.php definovat daleko v\u00edce parametr\u016f, ne\u017e jen ty, kter\u00e9 v n\u011bm naleznete po instalaci. Tento \u010dl\u00e1nek v\u00e1m p\u0159in\u00e1\u0161\u00ed tipy na n\u011bkter\u00e9 z nich.<\/p>\n","protected":false},"author":1,"featured_media":7649,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,30],"tags":[549],"class_list":["post-1000","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-navody","category-wordpress","tag-wp-config"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/1000"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=1000"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/1000\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/7649"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=1000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=1000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=1000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}