Opened 10 years ago
Last modified 2 months ago
#35099 reviewing enhancement
Make the filter links (Mine, Status, Author, Taxonomy, etc.) links in the posts list table filterable
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Future Release | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Posts, Post Types | Keywords: | has-patch has-test-info changes-requested |
| Focuses: | Cc: |
Description (last modified by )
In ticket #35097 I wrote about filter edit page title. @SergeyBiryukov found a solution. But I want filter url in "All, Published, Trash" and others. I want add taxonomy info and see show posts from taxonomy in trash.
add_filter('edit_link', 'wp_edit_link_filter');
function wp_edit_link_filter($url){
return add_query_arg(array('taonomy'=>'slug'), $url);
}
Attachments (1)
Change History (24)
#2
@
9 years ago
- Keywords has-patch added
- Summary changed from New filter: `edit_link` to Make the edit URL in the posts list table filterable
#3
@
9 years ago
- Summary changed from Make the edit URL in the posts list table filterable to Make the filter links (Mine, Status, Author, Taxonomy, etc.) links in the posts list table filterable
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
4 months ago
This ticket was mentioned in PR #9950 on WordPress/wordpress-develop by @SirLouen.
4 months ago
#6
Refreshing and adding an improvement to 35099.patch
#7
@
4 months ago
- Keywords needs-testing has-test-info added
- Milestone changed from Awaiting Review to Future Release
I agree with @DrewAPicture and all the suggestions are still valid 8 years later.
I’m going to push this forward with a new, refreshed, and slightly enhanced version. For the $class part. I’m not sure how this will benefit the filter itself, but personally I would rather pass all filterable values in a compact array.
Testing Instructions
Add this filter edit_filter_links and then you can pretty much edit everything. These filters affect these elements in edit.php. So after applying the filter, you should see modifications in these https://i.imgur.com/Lb921ut.png
Try modifying the url, the link_text and the css_class and observe results
This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.
4 months ago
This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.
4 months ago
#10
@
4 months ago
Test Report
Description
This report validates whether the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/9950
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.29
- Server: nginx/1.29.1
- Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
- Browser: Chrome 140.0.0.0
- OS: Windows 10/11
- Theme: Twenty Twenty-Five 1.3
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Actual Results
- ✅ Issue resolved with patch.
Additional Notes
- Example Filter Code
add_filter( 'edit_filter_links', function ( $edit_filter_link_vars ) { $edit_filter_link_vars['url'] = esc_url( home_url() ); $edit_filter_link_vars['css_class'] = 'test test2 test3'; $edit_filter_link_vars['link_text'] = 'Test'; return $edit_filter_link_vars; }, 10, 1 );
- After applying the filter link becomes
<a href="http://localhost:8889" class="test test2 test3">Test</a>
#11
@
4 months ago
Patch Testing for Issue “35099”
Test Report
Bug Description
"Mine" comment count isn't auto updated when replying to or moderating a comment. Requires manual refresh to count.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/9950
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.29
- Server: nginx/1.29.1
- Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
- Browser: Chrome 140.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.3
- MU Plugins: None activated
- Plugins:
- Edit Filter Links Test 0.3
- Test Reports 1.2.0
Actual Results
- ✅ Issue resolved with patch.
Testing Instructions
- Used the testing instructions from SirLouen
Add this filter edit_filter_links and then you can pretty much edit everything. These filters affect these elements in edit.php. So after applying the filter, you should see modifications in these https://i.imgur.com/Lb921ut.png
Try modifying the url, the link_text and the css_class and observe results
Additional Notes
Followed the testing instructions above.
Supplemental Artifacts
Code Used in the test plugin
<?php
/**
* Plugin Name: Edit Filter Links Test
* Description: Testing structured `edit_filter_links` filter.
* Version: 0.3
* Author: You
*/
add_filter(
'edit_filter_links',
function ( $edit_filter_link_vars ) {
// Change the link text: prepend "My "
$edit_filter_link_vars['link_text'] = 'My ' . $edit_filter_link_vars['link_text'];
// (Optional) change the URL
// $edit_filter_link_vars['url'] = esc_url( home_url() );
// (Optional) add CSS classes
// $edit_filter_link_vars['css_class'] .= ' test test2 test3';
return $edit_filter_link_vars;
},
10,
1
);
#12
@
4 months ago
- Keywords needs-testing removed
- Milestone changed from Future Release to 6.9
Code review and full testing finished
This is ready to be released.
This ticket was mentioned in Slack in #core by welcher. View the logs.
3 months ago
This ticket was mentioned in Slack in #core by welcher. View the logs.
3 months ago
#17
@
3 months ago
- Keywords changes-requested added; commit removed
I've left some feedback on the PR. I think the filter should operate on the final HTML string, not on the parameters that go into creating the HTML string.
#18
@
3 months ago
In reviewing this I am also finding the expansion of scope to be a little undesirable. When all that’s being filtered is the URL this remains a simple change, but compacting the attributes and filtering them raises a number of questions from how to properly document the intent of the filtering to what should happen if someone wants to add a new HTML attribute that isn’t in the filtered set to what if they want to add non-plaintext content inside the link text.
@westonruter’s idea of filtering the final HTML is pragmatic and allows people to modify the link using the HTML API. On the other hand, @sebastianpisula’s idea of filtering the URL solves the only known concrete problem mentioned in this ticket. While I might suggest a rename from edit_link to edit_link_url, that to me is the only solution not looking for a problem.
#19
@
3 months ago
- Milestone changed from 6.9 to 7.0
This one still has outstanding feedback that needs to be addressed. With 6.9 beta 1 due out in less than an hour, I'm going to punt to 7.0.
This ticket was mentioned in Slack in #core by desrosj. View the logs.
3 months ago
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
2 months ago
#23
@
2 months ago
- Milestone changed from 7.0 to Future Release
This seems to need a major code review, and I need to get a little deeper into the HTML API because I'm not well versed yet on how we could improve the current implementation alternatively.
For this reason, currently I won't be able to sustain a future 7.0 milestone, so I will leave it wider open for now, until I get the time to get hands-on with this.
So, I can see the value here, though I notice that the
get_edit_link()method is kind of poorly named because it effectively builds the "filtering" links for the posts list table. Based on the name, you'd think it was creating the edit post links.In terms of 35099.patch
edit_link_urlfor the hook name, if only to provide slightly more context@sinceversion$classvalue to the hook