Post Format Status [closed]

Post formats is an optional value added to WordPress posts which allows theme developers to define visual representation of a post. Theme developers can create themes with support for post formats. A number of post formats are available, however it is not possible for themes or plugins to introduce custom post formats. It is not … Read more

hide woo commerce dashboard status and reports from woo commerce from specific users but display to other users

For the dashboard case. if ( !current_user_can(‘manage_options’) ) { function remove_dashboard_widgets() { // remove WooCommerce Dashboard Status remove_meta_box( ‘woocommerce_dashboard_status’, ‘dashboard’, ‘normal’); } add_action(‘wp_user_dashboard_setup’, ‘remove_dashboard_widgets’, 20); add_action(‘wp_dashboard_setup’, ‘remove_dashboard_widgets’, 20); }

I am creating a front end dashboard where I need to show all the posts by the current user. So, I need to show posts in publish

I’m afraid I don’t understand the question perfectly, so I apologize, but, $post_status=”publish”; Wouldn’t that do it? I am missing context though, are you building a query? Because to get all the posts by the current user, something like this would be needed: $args = array( “post_status” => “publish”, “author” => get_current_user_id(), “posts_per_page” => 10 … Read more

Change post status by custom fields

All you need to do is to use save_post hook. Here’s how: function change_post_status_based_on_custom_field( $post_id ) { // If this is just a revision, don’t do anything. if ( wp_is_post_revision( $post_id ) ) return; // Get field value $value = get_post_meta( $post_id, ‘played’, true ); $status = $value ? ‘publish’ : ‘draft’; // If status … Read more

Identify and display the fact that user is admin next to username in comment section

From inside a comment Loop… $author_data = get_user_by(‘login’,$comment->comment_author); if (!empty($author_data)) { var_dump($author_data->roles); } $author_data->roles is an array so you will need to work out what you want to do with that. That is, print them all? Print the highest ranking role? if (array_intersect(array(‘administrator’,’moderator’),$author_data->roles)) { echo ‘admin’; } elseif (array_intersect(array(‘something’,’else’),$author_data->roles)) { echo ‘something else’; }