Restrict uploaded files into a custom folder to logged in users by htaccess: looking for Nginx – not only Apache – solution

The nginx equivalent of RewriteCond %{REQUEST_URI} ^.*wp-content/uploads/restricted/.* RewriteRule ^wp-content/uploads/(restricted/.*)$ dl.php?file=$1 [QSA,L] will be the location ~ ^/wp-content/uploads/(?<file>restricted/.*) { rewrite ^ /dl.php?file=$file last; } If you want to apply this to several folders under /wp-content/uploads, use location ~ ^/wp-content/uploads/(?<file>(?:restricted1|restricted2|restricted3)/.*) { rewrite ^ /dl.php?file=$file last; } I don’t think there can be any other solution for nginx … Read more

How to restrict the editors from viewing/editing pages created by admin?

This code will do the job… <?php add_action(‘pre_get_posts’, ‘filter_posts_list’); function filter_posts_list($query) { //$pagenow holds the name of the current page being viewed, we want to run our code only on edit.php (posts list) global $pagenow; //If the ‘Editor’ is logged in, exclude ‘Admin’s posts if(current_user_can(‘editor’) && (‘edit.php’ == $pagenow)) { //global $query’s set() method for … Read more

Hide everything on site for visitors except specific page IDs

If you want to show a message, use this code in your functions.php file- function se_236335_hide_content( $content ){ $pages = array( 8, 26, 35 ); // allowed page IDs if( ! in_array( get_the_id(), $pages ) ){ return ‘Message here..’; } return $content; } add_filter( ‘the_content’, ‘se_236335_hide_content’ ); If you want a page redirection, use this- … Read more

Taxonomies, restrict editing and creation of terms?

When you registered the taxonomy with register_taxonomy there is a capabilities argument. This takes, an array of the capabilities for this taxonomy. In particular: ‘manage_terms’ ‘edit_terms’ ‘delete_terms’ ‘assign_terms’ Associated with each of them should be a capability that it is required to be able to perform that action. For instance to assign_terms usually requires the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)