WordPress Network admin options page: how to store options and where will they be stored?
Use add_site_option() and update_site_option(). You can find these functions in wp-includes/functions.php.
Use add_site_option() and update_site_option(). You can find these functions in wp-includes/functions.php.
Use the Settings API. A look at my latest plugin may help you to understand how to register a save function for your fields. Most relevant excerpt: /** * Register custom settings for the fields. * * @see save_settings() * @see print_input_field() * @return void */ public function add_contact_fields() { register_setting( ‘general’, $this->option_name, array ( … Read more
To show content only for users with role ‘agent’, try to use this snippet: <?php if ( ( $user = wp_get_current_user() ) && in_array( ‘agent’, $user->roles ) ) { ?> ///here the content <?php } ?> If you want to block users by ID, check the following snippet: <?php if ( ( $user = wp_get_current_user() … Read more
You can do it by updating 2 options. <?php //This could be page or posts. update_option(‘show_on_front’, ‘<posts/page>’); //This one sets the page you want on front, won’t work if the above option is set to ‘posts’. update_option(‘page_on_front’, ‘<id of the page you want to set as front page>’); ?> Though I cannot guarantee if this … Read more
I have found the solution. I used the wordpress function wp_dropdown_pages <?php function combo_select_page_callback() { $options = get_option(‘function plugin’); wp_dropdown_pages( array( ‘name’ => ‘function plugin[ID used to identify the field throughout the theme]’, ‘echo’ => 1, ‘show_option_none’ => __( ‘— Select —’ ), ‘option_none_value’ => ‘0’, ‘selected’ => $options[‘ID used to identify the field throughout … Read more
I just did some searching and found this in the codex: add_settings_field( ‘myprefix_setting-id’, ‘This is the setting title’, ‘myprefix_setting_callback_function’, ‘general’, ‘myprefix_settings-section-name’, array( ‘label_for’ => ‘myprefix_setting-id’ ) ); Here is the link to the codex http://codex.wordpress.org/Function_Reference/add_settings_field Looks as simple as choosing the right slug like ‘general’ to add an option to the general settings page. I … Read more
The part of the capability is the job of the developers of the plugin. But normaly use the most plugins for manage options the object manage_options. But if you will, that your editor only change the plugin options from one plugin, than is this not so easy. All options of the core check for this … Read more
Welcome to the lions den So you’re willing to get down into the blazing furnace or the lions den and change the upload path. This is so not a good idea without investigating what is happening behind the scenes. I can’t give you a full write up, as there’s so much involved, like filters, options … Read more
So, everything seems to be set up correctly. The setting in your step 2 is everything that needs to be done. I won’t be able to help you without seeing how the theme’s template files are structured. The way it usually works when you apply the setting in your step 2 is that WordPress looks … Read more
do_action() does not use a returned value. It works more like the onload event in JavaScript: You cannot undo the load. To change a value you need filters. If you want to change the option content, hook into pre_update_option_{$option_name} very late (with a high priority parameter): add_filter( ‘pre_update_option_myp_settings’, ‘myp_settings_et_validate’, 100, 3 ); function myp_settings_et_validate( $option, … Read more