WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#13911 closed defect (bug) (invalid)

update_option bug

Reported by: jowo Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: General Keywords: reporter-feedback close
Focuses: Cc:

Description

update_option('show_on_front', 'page');
update_option('page_on_front', 1);

Does not work.

show_on_front is not updated in database
page_on_front does not even exist

Change History (6)

comment:1 jowo4 years ago

  • Keywords update_option show_on_front page_on_front removed

comment:2 nacin4 years ago

  • Keywords reporter-feedback close added
  • Milestone changed from 3.0 to Unassigned
  • Priority changed from high to normal

Works for me.

comment:3 jowo4 years ago

I tried this on a 3.0 MU-blog install.

Can't get it to work.

comment:4 filosofo4 years ago

you probably want update_site_option then.

comment:5 jowo4 years ago

Ok I finally tracked down the bug I was having. It was an error on my part.

In my plugin I did update_option() and below it I was running wp_delete_post(1, TRUE); which in turn reset those two options and actually deleted the "page_on_front" in database.

I guess because they are related and wp_delete_post() takes care of that. I thought it only worked with the wp_term* tables not options.

So works as intended.

Btw seems redundant to have two functions doing the exact same thing? update_option() seems to work as should.

comment:6 nacin4 years ago

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

They're different. update_option() updates a blog option, update_site_option() updates a network-wide option in multisite/MU mode.

Note: See TracTickets for help on using tickets.