{"id":14856,"date":"2019-11-14T06:36:47","date_gmt":"2019-11-14T06:36:47","guid":{"rendered":"https:\/\/ampforwp.com\/tutorials\/?post_type=ht_kb&#038;p=14856"},"modified":"2021-02-01T08:22:35","modified_gmt":"2021-02-01T08:22:35","slug":"how-to-show-or-hide-feature-according-to-the-user-role","status":"publish","type":"ht_kb","link":"https:\/\/ampforwp.com\/tutorials\/article\/how-to-show-or-hide-feature-according-to-the-user-role\/","title":{"rendered":"How to show or hide feature according to the user role"},"content":{"rendered":"\n<p>In this tutorial, I\u2019ll show you how to show or hide features like &#8220;Show AMP Ads for Current Post&#8221; according to the user role in AMP<\/p>\n\n\n\n<p>Open the post in the right-hand side two option will be displayed<strong> &#8220;show AMP for Current page&#8221; <\/strong>and<strong> &#8220;Show Ads for Current Page&#8221; <\/strong>by default, show option is selected. on which post you want to show or hide features according to the user role.  <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" loading=\"lazy\" width=\"345\" height=\"351\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/11\/1.png\" alt=\"\" class=\"wp-image-14857\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/11\/1.png 345w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/11\/1-295x300.png 295w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/11\/1-50x50.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/11\/1-60x60.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/11\/1-98x100.png 98w\" sizes=\"(max-width: 345px) 100vw, 345px\" \/><\/figure><\/div>\n\n\n\n<p>WordPress comes with a user role management system which defines what other people access so they can manage, edit or contribute to your site, WordPress user roles and permissions let you control what users can and can\u2019t do in AMP meta boxes like &#8220;show AMP for Current page&#8221; and &#8220;Show Ads for Current Page&#8221;  etc for this follow below steps.<\/p>\n\n\n\n<p>You will find this option in&nbsp;<strong>WordPress Dashboard<\/strong>&nbsp;-&gt; Navigate to&nbsp;<strong>AMP Option panel<\/strong>&nbsp;-&gt;<strong>&nbsp;Settings<\/strong>&nbsp;-&gt;&nbsp;<strong>Advance Settings<\/strong>&nbsp;-&gt;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" loading=\"lazy\" width=\"398\" height=\"582\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-11.png\" alt=\"\" class=\"wp-image-14188\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-11.png 398w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-11-205x300.png 205w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-11-34x50.png 34w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-11-41x60.png 41w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-11-68x100.png 68w\" sizes=\"(max-width: 398px) 100vw, 398px\" \/><\/figure><\/div>\n\n\n\n<p>Scroll down a little to see this option.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"927\" height=\"262\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-33-1.png\" alt=\"\" class=\"wp-image-14201\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-33-1.png 927w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-33-1-300x85.png 300w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-33-1-768x217.png 768w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-33-1-50x14.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-33-1-60x17.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/admin-33-1-100x28.png 100w\" sizes=\"(max-width: 927px) 100vw, 927px\" \/><\/figure>\n\n\n\n<ul><li><strong>Role-Based Access: <\/strong>This will allow only the \u201c<strong>Administrator<\/strong>\u201d and \u201c<strong>Editor<\/strong>\u201d to access the AMP Meta boxes and the other roles will not have any meta boxes in the post editor.<\/li><\/ul>\n\n\n\n<p><strong>That\u2019s it for this tutorial!<\/strong><\/p>\n\n\n\n<p>We hope it helped you. If you have any feedback or questions, then please share them in the comments section below.<\/p>\n<div id=\"div-1\" class=\"hkb-feedback\">\n\t\t\t<strong class=\"ht-mobile-exit__title\">Ask your Questions Directly!<\/strong><br>\n\t\t\t<div class=\"hkb_widget_exit__content\" style=\"font-size: 14px;\">If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!<\/div>\n\t\t\t<a href=\"https:\/\/ampforwp.com\/support\/#contact\" id=\"button\" target=\"_blank\" rel=\"noopener noreferrer\"><button>Yes, I have a Question<\/button><\/a>\n\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>In this tutorial, I\u2019ll show you how to show or hide features like &#8220;Show AMP Ads for Current Post&#8221; according to the user role in AMP Open the post in the right-hand side two option will be displayed &#8220;show AMP for Current page&#8221; and &#8220;Show Ads for Current Page&#8221; by&#8230;<\/p>\n","protected":false},"author":18,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":[],"ht-kb-category":[34],"ht-kb-tag":[],"_links":{"self":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/14856"}],"collection":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/comments?post=14856"}],"version-history":[{"count":6,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/14856\/revisions"}],"predecessor-version":[{"id":17908,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/14856\/revisions\/17908"}],"wp:attachment":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/media?parent=14856"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-category?post=14856"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-tag?post=14856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}