Whitelist Author of Private Post

You can use the post_password_required filter. function wpse406803_whitelist_author( $required, $post ) { //Check if current user is the post author if ( $post->post_author == get_current_user_id() ) { return false; } } add_filter( ‘post_password_required’, ‘wpse406803_whitelist_author’, 10, 2 );

Format the Layout of Images In The Edit Post Textarea?

Add this to your theme’s functions.php file: add_editor_style(); By default that function will load a file called editor-style.css which is located in the root directory of your theme. The functions accepts a filename or an array of filenames as parameter. Reference in the Codex: http://codex.wordpress.org/Function_Reference/add_editor_style If you want (or need to have) more control over … Read more

Change user role when post approve

You can attach code to change role when post status is changing from “pending” to “published” see documentation: http://codex.wordpress.org/Post_Status_Transitions Then, if user has role “contributor” you can change this to “author”: add_action( ‘pending_to_publish’. ‘my_function’, 10, 1 ); function my_function( $post ) { $wp_user_object = new WP_User( $post->post_author ); if ( in_array(‘contributor’, $wp_user_object->roles ) ) { … Read more

Multiple posts with fixed order position

The sequence field would determine where the promo post appears (position 2, 6, 8)? Anyway, I’d do it (and actually have done it) that way and would do it like that again. No other, more elegant way that comes to my mind.

How to change post status from frontend?

There isn’t much native functionality in WP to apply admin powers on front end. Front-end Editor plugin is usually great for such, but changing post status is one feature it seems to lack (maybe it’s worth suggesting to scribu). So you are basically stuck with writing this from scratch – implementing JS on front end … Read more

Using custom post template

$cat->1176 cannot be a property of an object. PHP Manual: A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: ‘[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*’ Use $cat->term_id and compare it’s value with the number you’re out for. And … don’t use … Read more