WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 5 months ago

#41893 new enhancement

Add URL filter in posts list table get_edit_link()

Reported by: GunGeekATX Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9
Component: Posts, Post Types Keywords: has-patch 2nd-opinion dev-feedback
Focuses: administration Cc:

Description

In get_edit_link() in the WP_Posts_List_Table class, the URL to edit.php is hard-coded and is not filterable. I'm currently working on a project that has complex filtering and the client wants to maintain the filters as they click through to different statuses.

Currently, the only way to update just the URL to edit.php is to use the "views_{$this->screen->id}" filter, use regex to find the URL in the markup, then update the URL in the markup as-needed. The proposed wp_posts_list_table_edit_url filter would allow filtering of the generated URL separate from the markup.

Attachments (1)

ticket-41893.patch (682 bytes) - added by GunGeekATX 3 years ago.

Download all attachments as: .zip

Change History (2)

#1 @valentinbora
5 months ago

  • Component changed from Administration to Posts, Post Types
  • Focuses administration added
  • Keywords has-patch 2nd-opinion dev-feedback added

Thanks for the ticket and the patch @GunGeekATX. It still seems to apply cleanly onto [47293] so that's great!

I've tried the filter out and it seems alright. Further, I'm looking forward to other opinions from Core folks regarding the opportunity as well as the naming of the filter hook and actual implementation.

Here are some sample parameters coming into the filter function for Posts:

Array
(
    [0] => edit.php?post_type=post
    [1] => Array
        (
            [post_type] => post
        )

)

Array
(
    [0] => edit.php?post_status=publish&post_type=post
    [1] => Array
        (
            [post_status] => publish
            [post_type] => post
        )

)

Array
(
    [0] => edit.php?post_status=draft&post_type=post
    [1] => Array
        (
            [post_status] => draft
            [post_type] => post
        )

)
Note: See TracTickets for help on using tickets.