WordPress.org

Make WordPress Core

#44069 closed defect (bug) (duplicate)

Private posts are not displayed in "Insert link" editor modal box

Reported by: fetard Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch
Focuses: ui, administration Cc:
PR Number:

Description

Steps to reproduce :

  • login to WordPress back-office with an "administrator" account
  • create an post with "private" visibility and save it
  • click on "Articles/Create new" on sidebar
  • click on "Insert link" icon in editor
  • type a word which is present on the "private post" title you just created

You can also click on the "wheel" and make a search with the same word

What happens
The "private post" is not displayed in search results

What should happen
The "private post" is displayed in search results

Attachments (1)

44069.1.diff (515 bytes) - added by audrasjb 19 months ago.
add private contents to wplink query

Download all attachments as: .zip

Change History (6)

@audrasjb
19 months ago

add private contents to wplink query

#1 @audrasjb
19 months ago

  • Keywords has-patch 2nd-opinion added

Hi @fetard thank for this ticket,

In 44069.1.diff:

  • Added private posts to wp_link_query() query

I'm not sure this is relevant, so if this is too specific for the general use case and closed as wontfix by the core team, @fetard I guess you can use wp_link_query_args filter to add private posts in your specific project :)

Cheers,
Jb

Last edited 19 months ago by audrasjb (previous) (diff)

#2 @subrataemfluence
19 months ago

@fetard If I have not understood wrong, by saying "search result" you meant the inline search which lists you list of available pages when typing in a keyword for adding a link.

To my understanding (may be wrong), if you are marking a post Private, the post can no way be displayed or even no link to it should be displayed by other posts to anonymous (not yet logged in). Since, you are not supposed to link a Private post directly from any other post, the private page link is not showing up.

Because if this new page is Published with Public visibility, the link will also be visible inside it. If a visitor clicks on it, he will land on a page saying something like Oops! That page can’t be found (message in twentyseventeen theme)

Now if you Publish your Private page and then try to link this from another page, it will be included and appear in search (list of available that could be linked).

I believe the filtration is intentional since Private pages are always meant to be protected from anonymous users.

The suggested patch brings up a private page in the list, but I don't think we really require this.

#3 follow-up: @nicomollet
19 months ago

Wouldn't it be useful to also check user capabilities? Like read_private_posts capability.

#4 in reply to: ↑ 3 @fetard
19 months ago

Replying to nicomollet:

Wouldn't it be useful to also check user capabilities? Like read_private_posts capability.

I think @subrataemfluence is right, this limit prevents user to insert in a public article towards a private content

#5 @ocean90
19 months ago

  • Keywords 2nd-opinion removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version 4.9.5 deleted

Hello @fetard, welcome to WordPress Trac!

Thanks for your report, we're already tracking this issue in #20114.

Note: See TracTickets for help on using tickets.