Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#38510 closed defect (bug) (fixed)

Twenty Seventeen: "Continue reading" is added to excerpts in the admin

Reported by: ocean90's profile ocean90 Owned by: davidakennedy's profile davidakennedy
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:

Description

twentyseventeen_excerpt_more() should get an is_admin() check since the excerpt_more filter is also used in the admin.

Attachments (8)

38510.png (78.9 KB) - added by ocean90 8 years ago.
38510.diff (527 bytes) - added by jeherve 8 years ago.
Twenty Seventeen: do not add a "Continue Reading" link to excerpts in admin.
38510.2.diff (530 bytes) - added by mangeshp 8 years ago.
38510.3.diff (400 bytes) - added by mangeshp 8 years ago.
Restrict the filter excerpt_more from getting load for admins.
38510.4.diff (862 bytes) - added by mangeshp 8 years ago.
38510.5.diff (1.1 KB) - added by mangeshp 8 years ago.
:D here is the final patch.
38510.2.png (110.5 KB) - added by mangeshp 8 years ago.
38510.6.diff (915 bytes) - added by mangeshp 8 years ago.

Download all attachments as: .zip

Change History (19)

@ocean90
8 years ago

@jeherve
8 years ago

Twenty Seventeen: do not add a "Continue Reading" link to excerpts in admin.

#1 @jeherve
8 years ago

  • Keywords has-patch added; needs-patch removed

#2 @ocean90
8 years ago

  • Keywords good-first-bug removed

@jeherve Thanks, but this ticket was tagged with good-first-bug

@mangeshp
8 years ago

#3 @mangeshp
8 years ago

If user wants to use twentyseventeen_excerpt_more() function for admins as well then checking is_admin() in function will restrict the user from using twentyseventeen_excerpt_more() function for admins.

So the filter excerpt_more can be loaded only for non-admins. Which will solve the problem.

@mangeshp
8 years ago

Restrict the filter excerpt_more from getting load for admins.

#4 @ocean90
8 years ago

  • Keywords needs-patch added; has-patch removed

Since this is a filter the original value should be returned if is_admin() is true.

@mangeshp
8 years ago

#5 @mangeshp
8 years ago

This patch #38510.4.diff is the final one if we want to disable twentyseventeen_excerpt_more() function for admins.

#6 @mangeshp
8 years ago

  • Keywords has-patch added; needs-patch removed

#7 @davidakennedy
8 years ago

Thanks @mangeshp! Your patch works, but can be simpler by returning in the function if `is_admin()' is true. Give it another shot. :)

@mangeshp
8 years ago

:D here is the final patch.

#8 @davidakennedy
8 years ago

You're close @mangeshp! And you have the right idea. :) But your current patch still modifies the the original value.

Look at your patch and 38510.diff and see if you can see the difference. Yours still modifies the the original value while the other stop the function from executing at all if the is_admin() is true. Try again!

@mangeshp
8 years ago

#9 @mangeshp
8 years ago

Thank you @davidakennedy for the feedback. :)

Agree with your point, but even this 38510.diff this patch modifies the original value. You get the above output when you just return; from the function.

Instead, it should return the original value i.e [...].

Submitting the another patch along with the correction in the Documentation block

@mangeshp
8 years ago

This ticket was mentioned in Slack in #core by mangesh. View the logs.


8 years ago

#11 @davidakennedy
8 years ago

  • Owner set to davidakennedy
  • Resolution set to fixed
  • Status changed from new to closed

In 39000:

Twenty Seventeen: Don't modify excerpt link in admin

  • Since this is a filter the original value is returned if is_admin() is true.
  • Removes portion of the doc block since function is not pluggable.

Props mangeshp.

Fixes #38510.

Note: See TracTickets for help on using tickets.