{"id":5814,"date":"2021-01-16T06:46:33","date_gmt":"2021-01-16T06:46:33","guid":{"rendered":"https:\/\/musilda.cz\/?p=5814"},"modified":"2021-01-16T06:46:33","modified_gmt":"2021-01-16T06:46:33","slug":"jak-zobrazit-skryta-metadata-u-wordpress-postu","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-zobrazit-skryta-metadata-u-wordpress-postu\/","title":{"rendered":"Jak zobrazit skryt\u00e1 metadata u WordPress postu"},"content":{"rendered":"\n

WordPress obsahuje mechanismu, kter\u00fd zabra\u0148uje editaci skryt\u00fdch metadat v administraci. Uk\u00e1\u017eeme si, jak to zm\u011bnit.<\/p>\n\n\n\n

Zobrazen\u00ed metadat v administraci <\/h2>\n\n\n\n

Kdy\u017e se pod\u00edv\u00e1te do administrace n\u011bjak\u00e9ho postu, uvid\u00edte ve spodn\u00ed \u010d\u00e1sti seznam takzvan\u00fdch custom field\u016f, neboli metadat:<\/p>\n\n\n\n

\"\"<\/a><\/figure>\n\n\n\n

Screen, kter\u00fd vid\u00edte je z detailu objedn\u00e1vky ve WooCommerce, jen\u017e nepou\u017e\u00edv\u00e1 Gutenberg. Pokud chcete zobrazit meta data v tomto editoru, mus\u00edte je povolit v preferenc\u00edch:<\/p>\n\n\n\n

\"\"<\/a><\/figure><\/div>\n\n\n\n

Co jsou skryt\u00e1 metadata?<\/h2>\n\n\n\n

V boxu custom field\u016f vid\u00edte v\u017edy n\u00e1zve pole a jeho hodnotu. N\u00e1zev m\u016f\u017ee b\u00fdt libovoln\u00fd, ale plat\u00ed, \u017ee pole s n\u00e1zvem „dobirka“ v boxu uvid\u00edte, pole s n\u00e1zvem „_dobirka“ ne. <\/p>\n\n\n\n

Podtr\u017e\u00edtko na za\u010d\u00e1tku n\u00e1zvu pole jej ozna\u010d\u00ed jako skryt\u00e9, tedy to co je pou\u017e\u00edv\u00e1no pro „syst\u00e9mov\u00e9“ \u00fa\u010dely. <\/p>\n\n\n\n

Jak povolit zobrazov\u00e1n\u00ed?<\/p>\n\n\n\n

Sta\u010d\u00ed do functions.php vlo\u017eit jednoduch\u00fd k\u00f3d:<\/p>\n\n\n\n

add_filter( 'is_protected_meta', '__return_false' ); <\/code><\/pre>\n\n\n\n

P\u0159\u00edpadn\u011b jej roz\u0161\u00ed\u0159it, pokud chcete zobrazit jen ur\u010dit\u00e9 polo\u017eky:<\/p>\n\n\n\n

add_filter( 'is_protected_meta', function( $protected, $meta_key, $meta_type )\n{\n    $allowed = array( '_edit_lock', '_test', '_wp_page_template' );\n    if( in_array( $meta_key, $allowed ) )\n        return false;\n\n    return $protected;\n}, 10, 3 );<\/code><\/pre>\n\n\n\n

A to je v\u0161e, nyn\u00ed m\u016f\u017eete editovat i skryt\u00e1 metadata, viz. obr\u00e1zek z adminu objedn\u00e1vky v eshopu:<\/p>\n\n\n\n

\"\"<\/a><\/figure>\n\n\n\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

WordPress obsahuje mechanismu, kter\u00fd zabra\u0148uje editaci skryt\u00fdch metadat v administraci. Uk\u00e1\u017eeme si, jak to zm\u011bnit. Zobrazen\u00ed metadat v administraci Kdy\u017e se pod\u00edv\u00e1te do administrace n\u011bjak\u00e9ho postu, uvid\u00edte ve spodn\u00ed \u010d\u00e1sti seznam takzvan\u00fdch custom field\u016f, neboli metadat: Screen, kter\u00fd vid\u00edte je z detailu objedn\u00e1vky ve WooCommerce, jen\u017e nepou\u017e\u00edv\u00e1 Gutenberg. Pokud chcete zobrazit meta data v tomto<\/p>\n","protected":false},"author":1,"featured_media":5600,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,30,34],"tags":[],"class_list":["post-5814","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippety","category-wordpress","category-wordpress-tipy"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/5814"}],"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=5814"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/5814\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/5600"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=5814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=5814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=5814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}