Skip to content

Commit 58809ae

Browse files
authored
Hide WooCommerce Extensions Menu Add
1 parent afdfd97 commit 58809ae

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- This is a code snippets export file generated by the Code Snippets WordPress plugin. -->
3+
<!-- https://wordpress.org/plugins/code-snippets -->
4+
<!-- To import these snippets a WordPress site follow these steps: -->
5+
<!-- 1. Log in to that site as an administrator. -->
6+
<!-- 2. Install the Code Snippets plugin using the directions provided at the above link. -->
7+
<!-- 3. Go to 'Tools: Import' in the WordPress admin panel. -->
8+
<!-- 4. Click on the "Code Snippets" importer in the list -->
9+
<!-- 5. Upload this file using the form provided on that page. -->
10+
<!-- 6. Code Snippets will then import all of the snippets and associated information contained in this file into your site. -->
11+
<!-- 7. You will then have to visit the 'Snippets: All Snippets' admin menu and activate desired snippets. -->
12+
<!-- generator="Code Snippets/2.9.4" created="2017-11-03 19:07" -->
13+
<snippets>
14+
<snippet scope="1">
15+
<name>Hide WooCommerce Extensions Menu</name>
16+
<desc></desc>
17+
<tags>hide, woocommerce, extensions, menu</tags>
18+
<code>add_filter( 'woocommerce_show_addons_page', 'wc_hide_extensions_menu' );&#13;
19+
&#13;
20+
function wc_hide_extensions_menu( $show_addons_page ) {&#13;
21+
//an array of user ids that can access the extensions menu&#13;
22+
$users_who_can_acess = array( 4, 8, 15, 16, 23, 42 );&#13;
23+
if ( ! in_array( get_current_user_id(), $users_who_can_acess ) ) {&#13;
24+
$show_addons_page = false;&#13;
25+
}&#13;
26+
return $show_addons_page;&#13;
27+
}</code>
28+
</snippet>
29+
</snippets>

0 commit comments

Comments
 (0)