Add content before/after admin post wp-list-table

I know there are two hooks to add content before and after a taxonomy wp-list-table.

Is there an action to add content after the post type wp-list-table on the edit.php page?

Read More

For $taxonomy List Tables:

add_action( 'category' . '_pre_add_form', 'copy_above_form' );
function copy_above_form( $taxonomy ) {
    echo '<p>Above the WP-List-Table</p>';
}

add_action( 'after-' . 'category' . '-table', 'copy_below_table' );
function copy_below_table( $taxonomy ) {
    echo '<p>Below the WP-List-Table</p>';
}

Reference: https://trepmal.com/action_hook/after-category-table/

Thanks!

Related posts

Leave a Reply

1 comment

  1. This has probably been solved many times here on this site, but maybe not with all your requirements? So let me try to answer it here:

    You can try to use the all_admin_notices and in_admin_footer actions, wrapped inside the load-edit.php action to target the edit.php page:

    add_action( 'load-edit.php', function(){
    
       $screen = get_current_screen(); 
    
        // Only edit post screen:
       if( 'edit-post' === $screen->id )
       {
            // Before:
            add_action( 'all_admin_notices', function(){
                echo '<p>Greetings from <strong>all_admin_notices</strong>!</p>';
            });
    
            // After:
            add_action( 'in_admin_footer', function(){
                echo '<p>Goodbye from <strong>in_admin_footer</strong>!</p>';
            });
        }
    });
    

    This will render like the following screenshots:

    Before:

    Before

    After:

    After

    You can then easily modify this to target the edit.php screen for different custom post types.

    Hope this helps.