I want to add some content, in the top or bottom of the wordpress edit.php page for a custom post type. What is the right filter or way to do this ?

  • 1
    What kind of content? Commented Jan 26, 2019 at 11:30
  • Some tags, html content
    – Amirition
    Commented Jan 26, 2019 at 11:55

2 Answers 2


The action load-edit.php is not needed. The answer on Stack Overflow is based on this WPSE answer: How do you create a custom edit.php / edit pages page that uses pre_get_posts, that's why it was encapsulated inside load-PAGE action.

On the screen edit.php we don't have any action hooks to insert content. We can only use the filter views_edit-POST_TYPE to do something there. With jQuery we can adjust the position on screen.

add_filter( 'views_edit-POST_TYPE', function($views){
    echo '<h2 style="display:none;" id="my-element">My Custom HTML</h2>';
    echo "<script>
    return $views;

Without jQuery it prints on position 1, and on position 2 using it.


Try following these lines to add html content to edit.php:

# Called only in /wp-admin/edit.php pages
add_action( 'load-edit.php', function() {
  add_filter( 'views_edit-talk', 'talk_tabs' ); // talk is my custom post type

# echo the tabs
function talk_tabs() {
 echo '
  <h2 class="nav-tab-wrapper">
    <a class="nav-tab" href="admin.php?page=guests">Profiles</a>
    <a class="nav-tab nav-tab-active" href="edit.php?post_type=talk">Talks</a>
    <a class="nav-tab" href="edit.php?post_type=offer">Offers</a>

Source: Stack Overflow - Add content to edit.php

  • But I dont wanna create new tabs
    – Amirition
    Commented Jan 26, 2019 at 12:59
  • Why don't you just put a link as comment to the original answer you have copied paste it from, you not even giving credits to that user on stackoverflow!
    – Charles
    Commented Jan 27, 2019 at 1:56
  • I am not just putting a link as a comment, as most of the users prefer the exact part of the solution in the answer. I have seen numerous times users are requesting the others to do that. However, I will include the link to the original answer from now. Commented Jan 27, 2019 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.