{"id":9843,"date":"2013-05-24T18:22:41","date_gmt":"2013-05-24T18:22:41","guid":{"rendered":"http:\/\/musilda.cz\/?p=465"},"modified":"2013-05-24T18:22:41","modified_gmt":"2013-05-24T18:22:41","slug":"jak-zobrazit-wordpress-administraci-pouze-pro-administratory","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-zobrazit-wordpress-administraci-pouze-pro-administratory\/","title":{"rendered":"Jak zobrazit WordPress administraci pouze pro administr\u00e1tory"},"content":{"rendered":"\n
Pro zamezen\u00ed p\u0159\u00edstupu registrovan\u00fdch u\u017eivatel\u016f do administrace, a\u0165 z jak\u00e9hokoliv d\u016fvodu, existuje \u0159ada plugin\u016f. Pokud v\u0161ak pot\u0159ebujete podobnou funkci zakomponovat do \u0161ablony, nebo nem\u016f\u017eete pou\u017e\u00edt plugin, pom\u016f\u017eou v\u00e1m dv\u011b jednoduch\u00e9 funkce, kter\u00e9 vlo\u017e\u00edte do souboru functions.php<\/p>\n\n\n\n\n\n\n\n
Nejprve skryjeme admin bar pro p\u0159ihl\u00e1\u0161en\u00e9 u\u017eivatele:<\/p>\n\n\n\n
if (!current_user_can('manage_options')) {\n\tadd_filter('show_admin_bar', '__return_false');\n}\n<\/pre>\n\n\n\nN\u00e1sledn\u011b ka\u017ed\u00e9ho, kdo by cht\u011bl vstoupit do administrace a nen\u00ed admin p\u0159esm\u011brujeme na hlavn\u00ed stranu na\u0161eho webu:<\/p>\n\n\n\n
add_action('admin_init','redirect_nonadmin_fromdash');\n\nfunction redirect_nonadmin_fromdash(){\n\nif (!current_user_can('manage_options')) {\n\nheader( 'Location: http:\/\/www.nase-sablona.cz\/' ) ;\n}\n\n}<\/pre>\n\n\n\nA to je v\u0161e.<\/p>\n","protected":false},"excerpt":{"rendered":"
Pro zamezen\u00ed p\u0159\u00edstupu registrovan\u00fdch u\u017eivatel\u016f do administrace, a\u0165 z jak\u00e9hokoliv d\u016fvodu, existuje \u0159ada plugin\u016f. Pokud v\u0161ak pot\u0159ebujete podobnou funkci zakomponovat do \u0161ablony, nebo nem\u016f\u017eete pou\u017e\u00edt plugin, pom\u016f\u017eou v\u00e1m dv\u011b jednoduch\u00e9 funkce, kter\u00e9 vlo\u017e\u00edte do souboru functions.php<\/p>\n","protected":false},"author":1,"featured_media":8624,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,30],"tags":[556],"class_list":["post-9843","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippety","category-wordpress","tag-zamezeni-pristupu-do-wordpress-administrace"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/9843"}],"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=9843"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/9843\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/8624"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=9843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=9843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=9843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}