Make WordPress Core

Opened 14 years ago

Closed 8 years ago

#12721 closed enhancement (wontfix)

Allow post_type's _edit_link to be outside of the admin.

Reported by: prettyboymp's profile prettyboymp Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch close
Focuses: Cc:

Description

get_edit_post_link runs the post_type's _edit_link through admin_url() always forcing the edit page to be within wp-admin. There are times where this isn't desired. I'm submitting a patch to check that the url of the _edit_link doesn't begin with http(s?): before running it through admin_url

Attachments (1)

12721.diff (786 bytes) - added by prettyboymp 14 years ago.

Download all attachments as: .zip

Change History (14)

@prettyboymp
14 years ago

#1 @chrisscott
14 years ago

  • Keywords tested added

Confirmed this is working against r13818. Edit post links in the admin still work and calling get_edit_post_link() from a theme file works.

#2 @prettyboymp
14 years ago

  • Keywords commit added

#3 @scribu
14 years ago

  • Keywords commit removed

Could you provide a use-case scenario?

#4 @prettyboymp
14 years ago

I've built several sites that allow user generated content, but don't allow normal users into the admin area. For those it would be nice not to have to filter the edit post link when I'm already setting up an _edit_link for the post_type.

#5 @scribu
14 years ago

I don't think you should mix the backend links with ones meant to enable frontend editing.

#6 @prettyboymp
14 years ago

What says the edit link is strict to backend? It is a link to where the content should be edited and in my case, I want it to be on a front end page. I don't understand your issue with this ticket.

#7 @prettyboymp
14 years ago

  • Keywords commit added

#8 @dd32
14 years ago

The attached patch requires that the _edit_link be set to the absolute URL. IMO, thats not going to be a flexible method.

There is nothing preventing you from filtering the link, Which is exactly what i do, Filtering the link allows for a much higher flexibility of the link created.

I for example, am using /wordpress/<post-name-here>/edit/<edit_revision_here>/ to handle my post edits, that would be next to impossible with the proposed solution as it can only insert the ID, I'd still have to filter it.

If the default admin link isnt powerful enough, filter it, there is no way you can create a complex link using that function for every use-case, so to me, it doesnt make sense here.

#9 @prettyboymp
14 years ago

  • Keywords commit removed

The absolute path is based off of the assumption that you would use site_url() to create the link when you pass it into the register_post_type method, so it is no less flexible than the current handling which is based on the path of wp-admin.

After some thought, to cut down on the slight performance hit of the regex running for each get_edit_post_link, I think the patch should be changed to add the admin_url or keep the absolute url during post_type registration instead. I'll submit a patch as soon as I know the entire ticket isn't getting shot down first.

#10 @markjaquith
14 years ago

  • Milestone changed from 3.0 to Future Release

Sounds like there is uncertainty about how to proceed. Punting.

#11 @nacin
10 years ago

  • Component changed from General to Post Types

#12 @chriscct7
8 years ago

  • Keywords close added; tested removed

#13 @johnbillion
8 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.