WordPress.org

Ready to get started?Download WordPress

Forums

Replacement for post_row_actions? (3 posts)

  1. clark kent
    Member
    Posted 2 years ago #

    Since post_row_actions has be deprecated (apparently) what can we use to replace it? I'm trying to work with a CPT and need to make some minor changes to the "Quick Edit" option. It seems that everywhere I looked everyone keeps saying to use post_row_actions, but I've read that it's been removed from 3.3.

    Any help would be GREATLY appreciated!

  2. dki
    Member
    Posted 2 years ago #

    when searching in wp core it appears in /wp-admin/includes/class-wp-posts-list-table.php:557

    557: $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );
    558: echo $this->row_actions( $actions );

    When going further... row_actions method is then located /wp-admin/includes/class-wp-list-table.php:325 which has following...

    /**
    * Generate row actions div
    *
    * @since 3.1.0
    * @access protected
    *
    * @param array $actions The list of actions
    * @param bool $always_visible Whether the actions should be always visible
    * @return string
    */
    function row_actions( $actions, $always_visible = false ) {
    $action_count = count( $actions );
    $i = 0;

    if ( !$action_count )
    return '';

    $out = '<div class="' . ( $always_visible ? 'row-actions-visible' : 'row-actions' ) . '">';
    foreach ( $actions as $action => $link ) {
    ++$i;
    ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    $out .= "<span class='$action'>$link$sep</span>";
    }
    $out .= '</div>';

    return $out;
    }

    as it states... @since 3.1.0 isnt so long time ago... would be weird if they used some methods only in one or two versions and then removed these again.

    But when looking in http://adambrown.info/p/wp_hooks/version/3.3
    neither post_row_action nor page_row_action is there. Tho media, user, tag and taxonomy still remain...

    anyhow... that is what we can call bad info..
    Tho you should still be able to use both post and page row_actions since they still appear in wp-core. till this stops working, THEN its deprecated :)

  3. Andrew Tegenkamp
    Member
    Posted 2 years ago #

    I'm probably way too late to help, but it looks like you can just hook into manage_posts_custom_column and use the <div class="row-actions"> or at least that's what the Automattic plugin Grunion Contact Form uses in the function grunion_manage_post_columns to setup the Spam and Trash links.

    As for editing what Quick Edit does, I haven't gone through it fully but believe http://www.ilovecolors.com.ar/saving-custom-fields-quick-bulk-edit-wordpress/ solves that as a tutorial.

Topic Closed

This topic has been closed to new replies.

About this Topic