Make post password required to publish

You would be better suited by allowing members to sign up on your site, then giving each uses level permissions to read different posts. A plugin like Members might work for this. But, if you really want to do what you asked, you’re going to have to do some javascript hacking or completely remove the … Read more

How to set privilege to wordpress subscriber for private page

Without a plugin something like this should work //functions.php function get_user_role() { global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); return $user_role; } //page template $role = get_user_role(); if($role == “subscriber”){ //cool you can see this } else { //sorry not allowed } A BETTER way would be to use something like the Members Plugins … Read more

Prevent private post 404

According to the Content Visibility page, Private posts are visible only to those with sufficient permission levels. WordPress doesn’t expose them to non-logged-in users at all, hence (presumably) the 404. If you want to display a limited preview to non-members, instead of setting the post to Private, you could try something like this: add_filter( ‘the_content’, … Read more

display public excerpt for private post

I’ve not tested this, but you should be able to complete this task by placing the following code in your template above the loop. query_posts( array( ‘post_status’ => array( ‘published’, ‘private’ ) ) ); This should allow for published and private posts to be displayed in that template.

WordPress i18n-friendly preg_replace post title

We can use the protected_title_format and private_title_format filters, available since WordPress version 2.8: add_filter( ‘protected_title_format’, ‘wpse_pure_title’, 10, 2 ); add_filter( ‘private_title_format’, ‘wpse_pure_title’, 10, 2 ); function wpse_pure_title( $format, \WP_Post $post ) { return ‘mycpt’ === get_post_type( $post ) ? ‘%s’ : $format; } to get rid of the “Private:” and “Protected:” parts on the front-end … Read more

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