pending posts widget

Viewing 0 reply threads
  • Author
    Posts
    • #9703
      Michael Mc
      Keymaster
      @mkmcst
      // Add a custom dashboard widget to display pending posts count
      function pending_posts_widget() {
          $pending_count = wp_count_posts('pending');
          echo '<p>Pending Posts: ' . $pending_count->pending . '</p>';
      }
      add_meta_box('pending_posts_widget', 'Pending Posts', 'pending_posts_widget', 'dashboard', 'side'); 
      
      // Optional: Add a visual alert on dashboard if pending posts exist
      function pending_post_alert() {
          $pending_count = wp_count_posts('pending');
          if ($pending_count->pending > 0) {
              echo '<div class="notice notice-warning"><p>You have ' . $pending_count->pending . ' pending posts to review.</p></div>';
          }
      }
      add_action('admin_notices', 'pending_post_alert'); 
Viewing 0 reply threads
  • You must be logged in to reply to this topic.