Limiting Shortcode
-
i want to put this code into shortcode.php so that only if admin write down the shortcode it will work and any people can view that. but if another user write down it will be taken as a simple text not as a shortcode, i mean it wont work. i am kinda a confused where i should put my code. here is a example code. you can modify.
function myshortcode(){ $user = wp_get_current_user(); if ( !in_array( 'author', (array) $user->roles ) ) { //Run shortcode } } add_shortcode('myshortcode','myshortcode');
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Limiting Shortcode’ is closed to new replies.