Remove hyperlink to edit post in edit.php

How can I remove the hyperlink to posts on the edit.php screen when listing all posts?

I am already removing the on hover links using the code below, but I want the actual post titles not to be hyperlinked at all.

Read More
add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );
function remove_row_actions( $actions )
{
    if( get_post_type() === 'wprss_feed_item' )
        unset( $actions['edit'] );
        unset( $actions['view'] );
        unset( $actions['trash'] );
        unset( $actions['inline hide-if-no-js'] );
    return $actions;
}

I also tried adding a column instead of the title column, and then echoing get_the_title() within that column. However in that case, although I would get rid of the hyperlink, I would lose the WP functionality that adds the quick links for trashing, editing etc. beneath the post title.

I also tried the following with no success:

add_filter( 'edit_post_link', 'remove_hyperlink_from_food_titles');

function remove_hyperlink_from_food_titles() {
    if ( 'edit-food_item' !== get_current_screen()->id )
    return;   

    return get_the_title();
}

Related posts

Leave a Reply

2 comments

  1. You can remove the a tag with javascript, short and easy.
    Use the follow plugin; include a small script in the footer of the edit.php, only this page in backend of WP and remove all a-tag inside the table; see the selector on the source below.

    <?php
    /**
     * Plugin Name: Remove a
     * Version:     0.0.1
     * Plugin URI:  http://wordpress.stackexchange.com/questions/65613/
     * Description: 
     * Author:      Frank Bültge
     * Author URI:  http://bueltge.de
     */
    
    if ( ! function_exists( 'wpse65613_remove_a' ) ) {
    
        add_action( 'admin_footer-edit.php', 'wpse65613_remove_a' );
    
        function wpse65613_remove_a() {
            ?>
            <script type="text/javascript">
                jQuery('table.wp-list-table a.row-title').contents().unwrap();
            </script>
            <?php
        }
    
    }
    

    The result:
    enter image description here

  2. All you’re searching for is right inside ~/wp-admin/includes/screen.php.

    We even got a tag for it: .

    If you can’t around it, you can still use a silly solution. Replace the link with # and change the CSS styles.

    <?php
    ! defined( 'ABSPATH' ) AND exit;
    /** Plugin Name: (#65629) »kaiser« Change WP List Table row title */
    
    function wpse65629_row_title_styles()
    {
        ?>
        <style type="text/css">
            #the-list .row-title {
                cursor: default;
                font-weight: normal;
                color: #555;
            }
        </style>
        <?php
    }
    add_action( 'admin_head-edit.php', 'wpse65629_row_title_styles' );
    
    function wpse65629_change_row_title( $url, $post_id, $context )
    {
        if ( 'edit-post' !== get_current_screen()->id )
            return;
    
        return '#';
    }
    add_filter( 'get_edit_post_link', 'wpse65629_change_row_title', 10, 3 );