WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 8 years ago

Last modified 5 years ago

#20690 closed defect (bug) (invalid)

add_post_meta/update_post_meta and cache

Reported by: nofearinc Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3.2
Component: Options, Meta APIs Keywords: reporter-feedback
Focuses: Cc:

Description

I have a custom post type with 2 fields for price, second one has 5% discount and I want to populate it automatically by hooking to 'save_post'.

I have a working logic that calls update_post_meta() (or add_post_meta() ) for the second field but it doesn't get executed even with several post updates. However, if I end my function call with a var_dump that outputs the values from the function, everything goes smooth.

It looks like some caching issue to me that gets flushed per var_dump call, anyone able to reproduce?

Change History (5)

#1 @nacin
8 years ago

  • Component changed from General to Options and Meta

#2 @ericlewis
8 years ago

  • Keywords reporter-feedback added

It's been a while, but can we see some code @nofearinc?

It sounds like some missed wp_is_post_revision() checking. I'm leaning towards a worksforme.

#3 @nofearinc
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

@ericlewis it's been quite some time and haven't been able to reproduce that ever since, it was probably fixed months ago. Marking it as "invalid" and if anyone is able to reproduce, we could reopen.

#4 @scottbasgaard
5 years ago

@nofearinc I actually ran into this today but need some time trying to reproduce on a clean install before reporting anything further.

#5 @scottbasgaard
5 years ago

Just in case anyone else does run into this changing priority to something lower than 10, e.g., 99 some how fixes this.

I've yet to properly test this on a trunk install further so let's keep it closed for now.

cc: @nofearinc

Note: See TracTickets for help on using tickets.