Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created a few options with with the register_setting function:

<?php register_setting( $option_group, $option_name, $sanitize_callback ); ?>

Is there a way to clear the whole content of the $option_group, and even the group itself.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Usually, the Codex is a good resource for doing research on things like this ... and there are functions related to register_setting() listed directly on it's page in the Codex.

The function you're looking for is unregister_setting(). From it's Codex page:

Description

Allows clean de-registration of registered settings. Should be used mostly in deactivation hooks.

Usage

unregister_setting( $option_group, $option_name, $sanitize_callback );

share|improve this answer
    
Yea I have seen this, but you still have to specify an $option_name. Is there no way to access the content of the option group itself. I think I have created some options from which I do not know the names anymore. That's why I want to remove the whole option group. I know about the Codex and the unregister function, should have added that to the question. I am looking for a better solution, if there is any. –  Saif Bechan Nov 5 '11 at 14:01
    
It sounds like what you're trying to do is delete some of those old options from your database, correct? –  chrisguitarguy Nov 5 '11 at 14:12
    
Yes I want to delete the options that were created in the option group. I do not know them all by name, but they were stored in one group. They don't bother me, but there has to be a way to get rid of them and keep things clean. –  Saif Bechan Nov 5 '11 at 19:22
    
Well I will just accept this as an answer. I still can not find anything that will completely solve this issue, but this is as close as you can get. –  Saif Bechan Nov 7 '11 at 14:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.