Filtering the post list in the admin area

How can I filter my custom post type like it’s filtered by WordPress itself? By that I mean the links that allow you to show only published, private or trashed posts.

I need it because I want to filter my event post type in a way that you’ll only see upcoming events at first, being still able to see all events.

Read More

I came across this question but it would be a dropdown instead of these links.

filters

[edit]

So what I want is to have a link Past events next to the Published link instead of using the standard dropdown menus.

[edit2]

I eventually did use a dropdown, based on this answer: https://wordpress.stackexchange.com/a/45447/28916

Related posts

1 comment

  1. I would suggest using post_submitbox_misc_actions action as shown in the below example to provide an option for Publish meta-box.

    <?php
    
    add_action( 'post_submitbox_misc_actions', 'my_post_submitbox_misc_actions' );
    
        function my_post_submitbox_misc_actions(){
        ?>
        <div class="misc-pub-section my-options">
            <label for="my_custom_post_action">My Option</label><br />
            <select id="my_custom_post_action" name="my_custom_post_action">
                <option value="1">First Option goes here</option>
                <option value="2">Second Option goes here</option>
            </select>
        </div>
        <?php
        }
    
        ?>
    

    Once used for at-least one post( or a CPT), then those options should appear beside publish actions in all posts admin page.

Comments are closed.