[11-Oct-2022 00:46:49 UTC] The Automattic\WooCommerce\Admin\API\Options::get_options function is deprecated since version 3.1.
[11-Oct-2022 00:46:50 UTC] The Automattic\WooCommerce\Admin\API\Options::update_options function is deprecated since version 3.1.
These statements were not present before the latest update.
Here is our system report:
### WordPress Environment ###
WordPress address (URL): https://www.porchlighteducation.org
Site address (URL): https://www.porchlighteducation.org
WC Version: 6.9.4
REST API Version: 6.9.4
WC Blocks Version: 8.3.3
Action Scheduler Version: 3.4.0
Log Directory Writable:
WP Version: 6.0.2
WP Multisite: –
WP Memory Limit: 512 MB
WP Debug Mode: –
WP Cron:
Language: en_US
External object cache: –
### Server Environment ###
Server Info: Apache
PHP Version: 7.4.32
PHP Post Max Size: 260 MB
PHP Time Limit: 180
PHP Max Input Vars: 3000
cURL Version: 7.85.0
OpenSSL/1.1.1q
SUHOSIN Installed: –
MySQL Version: 5.7.23-23
Max Upload Size: 256 MB
Default Timezone is UTC:
fsockopen/cURL:
SoapClient:
DOMDocument:
GZip:
Multibyte String:
Remote Post:
Remote Get:
### Database ###
WC Database Version: 6.9.4
WC Database Prefix: pace1880_
Total Database Size: 57.46MB
Database Data Size: 48.88MB
Database Index Size: 8.58MB
pace1880_woocommerce_sessions: Data: 0.03MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_api_keys: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_order_items: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_order_itemmeta: Data: 0.03MB + Index: 0.02MB + Engine MyISAM
pace1880_woocommerce_tax_rates: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_woocommerce_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_actionscheduler_actions: Data: 0.02MB + Index: 0.02MB + Engine MyISAM
pace1880_actionscheduler_claims: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_actionscheduler_groups: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_actionscheduler_logs: Data: 0.01MB + Index: 0.01MB + Engine MyISAM
pace1880_aiowps_debug_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
pace1880_aiowps_events: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_aiowps_failed_logins: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_aiowps_global_meta: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_aiowps_login_activity: Data: 0.04MB + Index: 0.01MB + Engine MyISAM
pace1880_aiowps_login_lockdown: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_aiowps_permanent_block: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_cf7dbplugin_st: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_cf7dbplugin_submits: Data: 0.28MB + Index: 0.05MB + Engine MyISAM
pace1880_commentmeta: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_comments: Data: 0.04MB + Index: 0.02MB + Engine MyISAM
pace1880_cpk_wpcsv_export_queue: Data: 0.03MB + Index: 0.01MB + Engine MyISAM
pace1880_cpk_wpcsv_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_content_status: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_core_status: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_flags: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_languages: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_icl_languages_translations: Data: 0.10MB + Index: 0.11MB + Engine MyISAM
pace1880_icl_locale_map: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_message_status: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_mo_files_domains: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
pace1880_icl_node: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_reminders: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_strings: Data: 4.38MB + Index: 2.75MB + Engine MyISAM
pace1880_icl_string_batches: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
pace1880_icl_string_packages: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_string_pages: Data: 0.41MB + Index: 0.76MB + Engine MyISAM
pace1880_icl_string_positions: Data: 0.94MB + Index: 0.22MB + Engine MyISAM
pace1880_icl_string_status: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_string_translations: Data: 2.07MB + Index: 0.76MB + Engine MyISAM
pace1880_icl_string_urls: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_icl_translate: Data: 0.33MB + Index: 0.05MB + Engine MyISAM
pace1880_icl_translate_job: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_translations: Data: 0.16MB + Index: 0.25MB + Engine MyISAM
pace1880_icl_translation_batches: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_icl_translation_downloads: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
pace1880_icl_translation_status: Data: 0.32MB + Index: 0.00MB + Engine MyISAM
pace1880_links: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_nextend2_image_storage: Data: 0.01MB + Index: 0.00MB + Engine MyISAM
pace1880_nextend2_section_storage: Data: 0.05MB + Index: 0.01MB + Engine MyISAM
pace1880_nextend2_smartslider3_generators: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_nextend2_smartslider3_sliders: Data: 0.06MB + Index: 0.00MB + Engine MyISAM
pace1880_nextend2_smartslider3_sliders_xref: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_nextend2_smartslider3_slides: Data: 0.06MB + Index: 0.01MB + Engine MyISAM
pace1880_options: Data: 3.88MB + Index: 0.14MB + Engine MyISAM
pace1880_postmeta: Data: 0.58MB + Index: 0.22MB + Engine MyISAM
pace1880_posts: Data: 5.57MB + Index: 0.16MB + Engine MyISAM
pace1880_relevanssi: Data: 0.56MB + Index: 0.64MB + Engine MyISAM
pace1880_relevanssi_log: Data: 0.14MB + Index: 0.10MB + Engine MyISAM
pace1880_relevanssi_stopwords: Data: 0.01MB + Index: 0.01MB + Engine MyISAM
pace1880_termmeta: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_terms: Data: 0.09MB + Index: 0.15MB + Engine MyISAM
pace1880_term_relationships: Data: 0.12MB + Index: 0.26MB + Engine MyISAM
pace1880_term_taxonomy: Data: 0.12MB + Index: 0.10MB + Engine MyISAM
pace1880_usermeta: Data: 0.05MB + Index: 0.05MB + Engine MyISAM
pace1880_users: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_wc_admin_notes: Data: 0.04MB + Index: 0.00MB + Engine MyISAM
pace1880_wc_admin_note_actions: Data: 0.02MB + Index: 0.01MB + Engine MyISAM
pace1880_wc_category_lookup: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wc_customer_lookup: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_wc_download_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wc_order_coupon_lookup: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wc_order_product_lookup: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_wc_order_stats: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_wc_order_tax_lookup: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
pace1880_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
pace1880_wc_product_meta_lookup: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
pace1880_wc_reserved_stock: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wc_tax_rate_classes: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_wc_webhooks: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wfBlockedIPLog: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_wfBlocks7: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wfConfig: Data: 2.88MB + Index: 0.01MB + Engine MyISAM
pace1880_wfCrawlers: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wfFileChanges: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wfFileMods: Data: 7.81MB + Index: 0.85MB + Engine MyISAM
pace1880_wfHits: Data: 0.69MB + Index: 0.15MB + Engine MyISAM
pace1880_wfHoover: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wfIssues: Data: 0.03MB + Index: 0.01MB + Engine MyISAM
pace1880_wfKnownFileList: Data: 5.81MB + Index: 0.26MB + Engine MyISAM
pace1880_wfLiveTrafficHuman: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_wfLocs: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wfLogins: Data: 0.11MB + Index: 0.03MB + Engine MyISAM
pace1880_wfls_2fa_secrets: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
pace1880_wfls_settings: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
pace1880_wfNotifications: Data: 0.05MB + Index: 0.01MB + Engine MyISAM
pace1880_wfPendingIssues: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wfReverseCache: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wfSNIPCache: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wfStatus: Data: 0.24MB + Index: 0.09MB + Engine MyISAM
pace1880_wfTrafficRates: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wonderplugin_carousel: Data: 0.03MB + Index: 0.00MB + Engine InnoDB
pace1880_wpb2d_processed_dbtables: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
pace1880_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
pace1880_wpmailsmtp_tasks_meta: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
pace1880_wpml_mails: Data: 10.48MB + Index: 0.03MB + Engine MyISAM
### Post Type Counts ###
attachment: 93
custom_css: 1
et_pb_layout: 20
nav_menu_item: 29
page: 173
post: 1
product: 4
revision: 1575
shop_coupon: 3
shop_order: 46
wpcf7_contact_form: 4
### Security ###
Secure connection (HTTPS):
Hide errors from visitors:
### Active Plugins (29) ###
WPML Multilingual CMS: by OnTheGoSystems – 4.5.11
All In One WP Security: by All In One WP Security & Firewall Team – 5.0.9
BBQ Firewall: by Jeff Starr – 20221002
Bright Platform For WordPress: by Aura Software – 12.6.0
Contact Form DB: by Michael Simpson – 2.10.28
Contact Form 7: by Takayuki Miyoshi – 5.6.3
Custom Post Type UI: by WebDevStudios – 1.13.1
Email Encoder – Protect Email Addresses: by Ironikus – 2.1.3
Google Analytics Dashboard for WP (GADWP): by ExactMetrics – 7.9.0
Loco Translate: by Tim Whitlock – 2.6.2
Smart Slider 3 Pro: by Nextend – 3.5.1.11
pace-bright-customizations: by Aura Software – 1.0
Post Tags and Categories for Pages: by curtismchale – 1.4.1
Post Types Order: by Nsp Code – 1.9.9.1
Relevanssi: by Mikko Saari – 4.17.1
Sucuri Security – Auditing, Malware Scanner and Hardening: by Sucuri Inc. – 1.8.35
Toggle The Title: by Avner Komarow – 1.4
UpdraftPlus – Backup/Restore: by UpdraftPlus.Com
DavidAnderson – 2.22.23.25
User Switching: by John Blackbourn & contributors – 1.7.0
Wonder Carousel Pro: by Magic Hills Pty Ltd – 18.7C
WooCommerce Stripe Gateway: by WooCommerce – 6.8.0
Simple Registration for WooCommerce: by Astoundify – 1.5.5
WooCommerce: by Automattic – 6.9.4
Wordfence Security: by Wordfence – 7.7.1
WP Fastest Cache Premium: by Emre Vona – 1.6.6
WP Fastest Cache: by Emre Vona – 1.0.6
WP Mail Logging: by Wysija – 1.10.4
WP Mail SMTP: by WPForms – 3.6.1
WPML String Translation: by OnTheGoSystems – 3.2.2
### Inactive Plugins (0) ###
### Must Use Plugins (1) ###
ET Support Center :: Must-Use Plugins Autoloader: by Elegant Themes –
### Settings ###
API Enabled: –
Force SSL: –
Currency: USD ($)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)
Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)
Connected to WooCommerce.com:
Enforce Approved Product Download Directories: –
### WC Pages ###
Shop base: #2869 – /shop/
Cart: #2870 – /cart/
Checkout: #2871 – /checkout/
My account: #2872 – /my-account/
Terms and conditions: Page not set
### Theme ###
Name: Divi-child
Version: 4.14.7
Author URL: https://example.com
Child Theme:
Parent Theme Name: Divi
Parent Theme Version: 4.18.0
Parent Theme Author URL: https://www.elegantthemes.com
WooCommerce Support:
### Templates ###
Overrides: –
### Admin ###
Enabled Features: activity-panels
analytics
coupons
customer-effort-score-tracks
experimental-products-task
experimental-import-products-task
experimental-fashion-sample-products
experimental-product-tour
shipping-smart-defaults
shipping-setting-tour
homescreen
marketing
mobile-app-banner
navigation
onboarding
onboarding-tasks
remote-inbox-notifications
remote-free-extensions
payment-gateway-suggestions
shipping-label-banner
subscriptions
store-alerts
transient-notices
wc-pay-promotion
wc-pay-welcome-page
Disabled Features: minified-js
new-product-management-experience
settings
Daily Cron: Next scheduled: 2022-10-11 08:39:30 -07:00
Options:
Notes: 102
Onboarding: completed
### Action Scheduler ###
Complete: 34
Oldest: 2022-10-10 17:36:21 -0700
Newest: 2022-10-10 17:41:24 -0700
Pending: 1
Oldest: 2022-10-11 12:21:48 -0700
Newest: 2022-10-11 12:21:48 -0700
### Status report information ###
Generated at: 2022-10-11 01:08:12 -07:00
]]>I can get the selected fields to echo out, but they don’t seem to be saving, i.e. when page is reloaded the selections are gone.
the fields:
<select id="exclude_page_from_cookies" name="exclude_page_from_cookies[]" multiple="multiple">
<?php
$pages = get_pages();
foreach ( $pages as $page ) {
$title = $page->post_title;
$id = $page->id;
?>
<option id="<?php echo $id; ?>" value="<?php echo $title ?>" <?php selected( $title ); ?> >
<?php echo $title;?>
</option>
<?php
}
?>
</select>
The save
if ( isset( $_POST['exclude_page_from_cookies'] ) ) {
foreach( $_POST['exclude_page_from_cookies'] as $exclude_page ) {
echo $exclude_page;
update_option( 'exclude_page_from_cookies', $exclude_page ) ;
}
}
Thank you all in advance.
]]>I can get the selected fields to echo out, but they don’t seem to be saving, i.e. when page is reloaded the selections are gone.
the fields:
<select id="exclude_page_from_cookies" name="exclude_page_from_cookies[]" multiple="multiple">
<?php
$pages = get_pages();
foreach ( $pages as $page ) {
$title = $page->post_title;
$id = $page->id;
?>
<option id="<?php echo $id; ?>" value="<?php echo $title ?>" <?php selected( $title ); ?> >
<?php echo $title;?>
</option>
<?php
}
?>
</select>
The save
if ( isset( $_POST['exclude_page_from_cookies'] ) ) {
foreach( $_POST['exclude_page_from_cookies'] as $exclude_page ) {
echo $exclude_page;
update_option( 'exclude_page_from_cookies', $exclude_page ) ;
}
}
Thank you all in advance.
]]>I have a 4 var array, and try to update_option and get 2 var that is getting updated insted of 4. The script is running on admin_init.
$new_settings = array(
'Candle' => $options['Candle'],
'Havdala' => $options['Havdala'],
'updatestatus' => $updatestatus,
'lastUpdate' => $nextUpdate,
);
update_option('wp_shabbat_settings', $new_settings);
When the plugin is created I register the function:
// create default values when user activate plugin
function wp_shabbat_activate() {
delete_option('wp_shabbat_settings');
$settings = array(
'CandleDefault' => 20,
'HavdalaDefault' => 18,
'Candle' => 20,
'Havdala' => 18,
'updatestatus' => 'Plugin DataBase need to be updated',
'lastUpdate' => 0,
);
add_option('wp_shabbat_settings', $settings);
include( plugin_dir_path( __FILE__ ) . 'wp-shabbat-update.php');
}
register_activation_hook( __FILE__, 'wp_shabbat_activate' );
If I change the first two values the db getting updated , but last 2 aren’t changing.
I tried this also and got the same result.
$new_settings = array(
'Candle' =>55,
'Havdala' => 55,
'updatestatus' => 55,
'lastUpdate' =>55,
);
print_r($new_settings);
update_option('wp_shabbat_settings', $new_settings);
print_r(get_option('wp_shabbat_settings'));
result of print_r:
Array ( [Candle] => 55 [Havdala] => 55 [updatestatus] => 55 [lastUpdate] => 55
result print_r(get_option(‘wp_shabbat_settings’)):
Array ( [Candle] => 55 [Havdala] => 55 [updatestatus] => file extracted succefully [lastUpdate] => 1391212800
more details:
if i delete the db delete_option(‘wp_shabbat_settings’); and then insert the 6 vlues to db add_option(‘wp_shabbat_settings’, $new_settings); , I get only 2 inside.
$new_settings = array(
'CandleDefault' => 20,
'HavdalaDefault' => 18,
'Candle' => 20,
'Havdala' => 18,
'updatestatus' => 'Plugin DataBase need to be updated',
'lastUpdate' => 0,
);
print_r($new_settings);
delete_option('wp_shabbat_settings');
add_option('wp_shabbat_settings', $new_settings);
print_r(get_option('wp_shabbat_settings'));
result print_r($new_settings);:
Array ( [CandleDefault] => 20 [HavdalaDefault] => 18 [Candle] => 20 [Havdala] => 18 [updatestatus] => Plugin DataBase need to be updated [lastUpdate] => 0 )
result print_r(get_option(‘wp_shabbat_settings’)); :
Array ( [Havdala] => 18 [Candle] => 20 )
pls if u can help, the whole project is here :
https://github.com/drmosko/wp-shabbat
I’m using an OOP framework into which I’ve shoe-horned the code from a plugin I’ve built. Problem is, the framework offers a means of updating plugin options and although I’m successfully requesting a response from a third party API, I can’t update the option ‘status’ of my plugin. Any thoughts on where I’m going wrong?
Here is the update function:
private function _admin_options_update() {
// Verify submission for processing using wp_nonce
if( wp_verify_nonce( $_REQUEST['_wpnonce'], "{$this->namespace}-update-options" ) ) {
$data = array();
/**
* Loop through each POSTed value and sanitize it to protect against malicious code. Please
* note that rich text (or full HTML fields) should not be processed by this function and
* dealt with directly.
*/
foreach( $_POST['data'] as $key => $val ) {
$data[$key] = $this->_sanitize( $val );
}
/**
* Place your options processing and storage code here
*/
// Update the options value with the data submitted
update_option( $this->option_name, $data );
// Redirect back to the options page with the message flag to show the saved message
wp_safe_redirect( $_REQUEST['_wp_http_referer'] . '&update=1' );
exit;
}
}
I’m trying to run this function:
update_option( $WPBackitup->options['status'], $license_data->license );
I copied the code to my live site, and only part of it works.
Any ideas why it is not doing the select properly, or updating all of the options instead of just the last?
<?php
/*
Plugin Name: My little plugin
Plugin URI: https://mysite.com
Description: A plugin.
Version: 0.0.1
Author: Kirk
Author URI: https://mysite.com
License: Custom, Unlicensed, Take Your Chances
*/
/* What to do when the plugin is activated? */
register_activation_hook(__FILE__,'mysite_pro_niches_plugin_install');
/* What to do when the plugin is deactivated? */
register_deactivation_hook( __FILE__, 'mysite_pro_niches_plugin_remove' );
function mysite_pro_niches_plugin_install() {
/* Create a new database field */
add_option("niche1", 'autobody', '', 'no');
add_option("n1t1", 'Enter your first testimonial', '', 'no');
add_option("n1t2", 'Enter your second testimonial', '', 'no');
}
function mysite_pro_niches_plugin_remove() {
/* Delete the database field */
delete_option('niche1');
delete_option('n1t1');
delete_option('n1t2');
}
add_action('admin_menu', 'mysite_pro_niches_admin_menu');
function mysite_pro_niches_admin_menu() {
add_options_page('Plugin Admin Options', 'Pro Niches Settings', 'manage_options', 'mysite_pro_niches', 'plugin_admin_options_page');
}
function plugin_admin_options_page() {
?>
<div class="wrap">
<?php screen_icon(); ?>
<h2>Plugin Options Admin Page</h2>
<p>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>
<center>
<br /><br />
<h2>You can change your niche from <?php $option = 'niche1'; $default = ''; echo get_option( $option, $default ); ?> by selecting it in the box below<br />and then clicking on the "Save Changes" button.</h2>
<br /><br />
<?php $current_niche = get_option(niche1); ?>
<select name="niche1">
<option value="none" <?php if ($current_niche == "none") echo ('selected="selected"'); ?> >Clear Database</option>
<option value="autobody" <?php if ($current_niche == "autobody") echo ('selected="selected"'); ?> >Autobody Repair</option>
<option value="builders" <?php if ($current_niche == "builders") echo ('selected="selected"'); ?> >Builders and Contracters</option>
<option value="c-stores" <?php if ($current_niche == "c-stores") echo ('selected="selected"'); ?> >Convenience Stores</option>
</select>
<br />
<br />
<textarea name="n1t1" rows="5" cols="100" wrap="soft" maxlength="250" ><?php echo get_option(n1t1); ?></textarea>:<br />
<textarea name="n1t2" rows="5" cols="100" wrap="soft" maxlength="150" ><?php echo get_option(n1t2); ?></textarea>:<br />
<br />
<br />
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="niche1" />
<input type="hidden" name="page_options" value="n1t1" />
<input type="hidden" name="page_options" value="n1t2" />
<input type="submit" value="Save Changes" />
</form>
</p>
</div>
<?php
}
// End of page
?>
]]>// Flush rules to pick up the new page.
$wp_rewrite->init();
$wp_rewrite->flush_rules();
If so, it the purpose of the rewrite to insure that the .htaccess file gets updated?
I ask this because just after executing the function, my pages return 404’s even though the permalinks_options.php reports that the permalink is indeed set to custom: ‘/%postname%/’)
However, I have to manually hit “Save Changes” on the permalink options page to make it stick. I’m wondering if the fix is to add the rewrite code above, or am I missing something?
]]>I’m assuming this has something to do with how update_options works. I’ve briefly looked at how the function works, but I was hoping someone might of encountered this before and know how to circumvent it.
Suggestions?
]]>