WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#20218 closed enhancement (fixed)

set_post_thumbnail(): update_post_meta() could fail

Reported by: webord Owned by: duck_
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.4
Component: Post Thumbnails Keywords: has-patch commit
Focuses: Cc:

Description

So I'm in a project where the defined thumbnail must always be bigger then a certain size, and my problem is whether I can filter to check the size of the image, using a filter on the update_{$meta_type}_metadata, the function set_post_thumbnail(), always return true, so my change is really small so the developer can filter and return false if it pleases;

In my case I would filter that and the content on admin_post_thumbnail_html to Warn the user that he cannot set a thumbnail with this size.

Check out the .diff, and if there any other place that I can change something, to make it better warn me.

Attachments (1)

post.diff (577 bytes) - added by webord 2 years ago.
Changes

Download all attachments as: .zip

Change History (8)

webord2 years ago

Changes

comment:1 scribu2 years ago

  • Keywords has-patch added; dev-feedback removed

Makes sense.

comment:2 follow-up: scribu2 years ago

  • Keywords commit added

comment:3 in reply to: ↑ 2 webord2 years ago

Replying to scribu:
Question, what I should do now? I should: patch -p0 < post.diff ?

I don't really know how to patch something I did. Thanks a lot.

comment:4 scribu2 years ago

Now you wait for someone with commit access to commit your patch.

comment:5 webord2 years ago

Thanks!

comment:6 duck_2 years ago

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

In [20172]:

Use return value of update_post_meta() in set_post_thumbnail() instead of always returning true. Props webord. Fixes #20218.

comment:7 duck_2 years ago

  • Milestone changed from Awaiting Review to 3.4
  • Summary changed from Filter set_post_thumbnail() to set_post_thumbnail(): update_post_meta() could fail
Note: See TracTickets for help on using tickets.