{"id":2229,"date":"2021-05-12T18:06:30","date_gmt":"2021-05-12T18:06:30","guid":{"rendered":"https:\/\/kadencecloud.com\/?post_type=knowledgebase&#038;p=2229"},"modified":"2026-04-22T15:16:36","modified_gmt":"2026-04-22T15:16:36","password":"","slug":"limit-access-keys-to-a-specific-site","status":"publish","type":"docs","link":"https:\/\/www.kadencewp.com\/help-center\/docs\/kadence-cloud\/limit-access-keys-to-a-specific-site\/","title":{"rendered":"How To Limit an Access Key to a Specific Site"},"content":{"rendered":"\n<p>Using the <a rel=\"noreferrer noopener\" href=\"https:\/\/kadence-theme.com\/knowledge-base\/advanced\/how-to-add-a-custom-filter-or-function-with-code-snippets\/\" data-type=\"URL\" data-id=\"https:\/\/kadence-theme.com\/knowledge-base\/advanced\/how-to-add-a-custom-filter-or-function-with-code-snippets\/\" target=\"_blank\">Code Snippet plugin<\/a> you can filter the access key verification check to make sure access is only given to a specific site.<\/p>\n\n\n\n<p>Add a PHP snippet with the following code, just changing your ACCESS_KEY and WEBSITE.COM with the key you want to limit and the site you want to limit it to.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">\/**\n * Checks for specific key and makes sure that key only works on a specific site.\n *\n * @param Boolean $access true or false based on access.\n * @param String $key the access key.\n * @param WP_REST_Request $request full details about the request.\n * @return Boolean based on if access should be granted.\n *\/\nfunction custom_kadence_cloud_access_filter( $access, $key, $request ) {\n    if ('ACCESS_KEY' === $key ) {\n        $site = preg_replace(\"(^https?:\/\/)\", \"\", $request-&gt;get_param( 'site' ) );\n        if ( $site &amp;&amp; 'WEBSITE.COM' === $site ) {\n            return true;\n        } else {\n            return false;\n        }\n    }\n    return $access;\n}\nadd_filter( 'kadence_cloud_rest_request_access', 'custom_kadence_cloud_access_filter', 10, 3 );<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Using the Code Snippet plugin you can filter the access key verification check to make sure access is only given to a specific site. Add a PHP snippet with the following code, just changing your ACCESS_KEY and WEBSITE.COM with the key you want to limit and the site you want to limit it to.<\/p>\n","protected":false},"author":1265,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"doc_category":[416],"doc_tag":[],"knowledge_base":[10],"class_list":["post-2229","docs","type-docs","status-publish","hentry","doc_category-advanced-access-keys","knowledge_base-kadence-cloud"],"year_month":"2026-04","word_count":153,"total_views":"2697","reactions":{"happy":"14","normal":"0","sad":"0"},"author_info":{"display_name":"Ben Ritner","author_link":"https:\/\/www.kadencewp.com\/help-center\/author\/britner\/"},"doc_category_info":[{"term_name":"Advanced Access Keys","term_url":"https:\/\/www.kadencewp.com\/help-center\/knowledge-base\/kadence-cloud\/advanced-access-keys\/"}],"doc_tag_info":[],"knowledge_base_info":[{"term_name":"Kadence Pattern Hub","term_url":"https:\/\/www.kadencewp.com\/help-center\/knowledge-base\/kadence-cloud\/","term_slug":"kadence-cloud"}],"knowledge_base_slug":["kadence-cloud"],"taxonomy_info":{"doc_category":[{"value":416,"label":"Advanced Access Keys"}],"knowledge_base":[{"value":10,"label":"Kadence Pattern Hub"}]},"featured_image_src_large":false,"comment_info":0,"_links":{"self":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs\/2229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/users\/1265"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/comments?post=2229"}],"version-history":[{"count":2,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs\/2229\/revisions"}],"predecessor-version":[{"id":16763,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs\/2229\/revisions\/16763"}],"wp:attachment":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/media?parent=2229"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/doc_category?post=2229"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/doc_tag?post=2229"},{"taxonomy":"knowledge_base","embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/knowledge_base?post=2229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}