Describe the bug
On the Distributor->pull content->pulled list table the href attribute of the edit link below the post title is empty if the current user cannot edit that post (see image).
I realise that this is probably an edge-case, but on our (multisite/internal connections) setup we don't allow editing of pulled/pushed posts on any other site than the origin. To enforce this we have a filter on the edit_post capability (using map_meta_cap) to check if the post is pulled/pushed from another site and if so we don't allow editing of that post. This leads to the edit link being empty since the call to get_edit_post_link() in class PullListTable won't return anything.
An easy fix for this is to move the edit key in the $actions list one line down and add a current_user_can check around it, like so:
if ( current_user_can( 'edit_post', $new_post_id ) ) {
$actions['edit'] = '<a href="' . esc_url( get_edit_post_link( $new_post_id ) ) . '">' . esc_html__( 'Edit', 'distributor' ) . '</a>';
}
Steps to Reproduce
- Add something like this to an mu-plugin or the functions.php file of your theme:
/**
* Do not allow distributed posts to be edited on other sites than their origin site.
*/
add_filter(
'map_meta_cap',
function( array $caps, string $cap, int $user_id, array $args ): array {
if ( 'edit_post' === $cap ) {
$post = get_post( $args[0] );
if (
! is_null( $post )
&& 'post' === $post->post_type
&& get_post_meta( $post->ID, 'dt_original_blog_id', true )
) {
$caps = [];
$caps[] = 'do_not_allow';
}
}
return $caps;
},
10,
4
);
- Go to Distributor->pull content
- Pull content from an internal (multisite) connection
- Go to Distributor->pull content->pulled
- Check the edit links href attribute and notice it's empty
Expected behavior
The edit link is not shown if the current user cannot edit the post.
Screenshots

Environment information
- Distributor version: 1.5.0
- Theme and version: Twenty Nineteen 1.4
- Other installed plugin(s) and version(s): none
- WordPress 5.2.3
Describe the bug
On the Distributor->pull content->pulled list table the href attribute of the edit link below the post title is empty if the current user cannot edit that post (see image).
I realise that this is probably an edge-case, but on our (multisite/internal connections) setup we don't allow editing of pulled/pushed posts on any other site than the origin. To enforce this we have a filter on the
edit_postcapability (usingmap_meta_cap) to check if the post is pulled/pushed from another site and if so we don't allow editing of that post. This leads to the edit link being empty since the call toget_edit_post_link()in class PullListTable won't return anything.An easy fix for this is to move the edit key in the $actions list one line down and add a current_user_can check around it, like so:
Steps to Reproduce
Expected behavior
The edit link is not shown if the current user cannot edit the post.
Screenshots
Environment information