Hide custom posts from certain taxonomy in rest api
Hide custom posts from certain taxonomy in rest api
Hide custom posts from certain taxonomy in rest api
Try this code in function.php I hope this help. add_action( ‘rest_api_init’, ‘set_image_dimension_limit’ ); function set_image_dimension_limit() { add_filter( ‘wp_handle_upload_prefilter’, function( $file ) { $mimes = array( ‘image/jpeg’, ‘image/png’, ‘image/gif’ ); if( !in_array( $file[‘type’], $mimes ) ) return $file; $img = getimagesize( $file[‘tmp_name’] ); $maximum = array( ‘width’ => 500, ‘height’ => 700 ); if ( $img[0] … Read more
Multisite Login Access Restrictions
Valid WordPress html elements
I would use .htaccess. To do so you can: Login via FTP, sFTP or SSH to your WordPress root installation. Find and open .htaccess file. Visit this website and choose the countries you want to block. It will generate a list of IPs ready to copy and paste on your .htaccess. Paste the list. If … Read more
The following code shows how you can restrict some users from viewing a certain page. This could either be placed in a stand-alone plugin or the themes functions.php file. The code is fairly self-explanatory but I’ll walk through it. First, pick an appropriate hook to use. I chose wp because it’s after WordPress is fully … Read more
In short, the $post global isn’t setup at the wp_loaded state. See: When and Where is global $post Set and Available? for detailed information. So use another hook, like template_redirect.
I don’t know the plugin, but with a rapid eye on it, it seems that what you want is not, but you can rely on widget_content filter fired by the plugin you are using. So, in your theme function.php put: if ( function_exists(‘widget_logic_redirected_callback’) ) add_filter(‘widget_content’, ‘my_widget_for_user’, 10, 2); function my_widget_for_users ($widget_content, $widget_id) { $allowed_users = … Read more
The codex entry for the admin_init hook has an example showing you how to do this. /** * Restrict access to the administration screens. * * Only administrators will be allowed to access the admin screens, * all other users will be automatically redirected to * ‘example.com/path/to/location’ instead. * * We do allow access for … Read more
The best way to have complete control is to use conditionals in your templates. Look at current_user_can() for specific permissions – or if its simply for being logged in you could use is_user_logged_in(). eg: if( is_user_logged_in() ){ // echo product details }else{ //echo login form and message } That we you have complete control over … Read more