Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#13911 closed defect (bug) (invalid)

update_option bug

Reported by: jowo's profile 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)

#1 @jowo
15 years ago

  • Keywords update_option show_on_front page_on_front removed

#2 @nacin
15 years ago

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

Works for me.

#3 @jowo
15 years ago

I tried this on a 3.0 MU-blog install.

Can't get it to work.

#4 @filosofo
15 years ago

you probably want update_site_option then.

#5 @jowo
15 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.

#6 @nacin
15 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.