WordPress: update_option, don’t update empty options?

More importantly, you should not let *untrusted, unsanitized $_POST data* into WordPress. But I think the issue is that you’re updating the option with the entire $_POST data, instead of the appropriate array key: update_option(‘eirepanel_inline_ads_options’, $_POST); Should probably be something like: update_option(‘eirepanel_inline_ads_options’, $_POST[‘eirepanel_inline_ads_options_name’]); Are your Plugin options discrete (one DB entry per option), or an … Read more

Setting up a members area

I’m in the process of establishing a members site. You can find a bunch of premium plugins to pay for…and a few free ones like s2member, Membership lite or Members. I decided to go with Members and write everything else i need (like paypal integration and so on) myself.

Need help understanding/coding with Settings API

You have some of the callback functions and the ID’s mixed up, try this: add_action(‘admin_init’, function() { register_setting(‘elem_opts’, ‘elem_opts’, ‘elem_validate_opts’); add_settings_section(‘elem_opts_form1’, ‘Elements Theme Options’, ‘elem_opts_form’, ‘elem_opts’); add_settings_field(‘elem_opts_form’, ‘Facebook’, ‘elem_opts_social_fb_cb’, ‘elem_opts’, ‘elem_opts_form1’); }); function elem_opts_social_fb_cb() { $opts = get_option(‘elem_opts’); if (empty($opts) || !is_array($opts)) { $opts = array(); } ?> <input type=”text” name=”elem_opts[fb]” value=”<?php echo $opts[‘fb’] ? … Read more

Display user HTML on website

You may need to un-escape the output. Take a look at html_entity_decode or similar functions before outputting to the screen. $orig = “I’ll \”walk\” the <b>dog</b> now”; $a = htmlentities($orig); $b = html_entity_decode($a); echo $a; // I’ll &quot;walk&quot; the &lt;b&gt;dog&lt;/b&gt; now echo $b; // I’ll “walk” the <b>dog</b> now html_entity_decode function MKWD_Display_Westmor_Bottom_Left() { $westmor_customers_options = … Read more

PHP stylesheet cannot use standard WP functions

If you’re linking to a file, it’s opened as a new file. So unless you explicitly include wp_load.php or something within that styles file, WordPress is not available. Loading WP all over again in one page load seems like complete overkill to me. Why don’t you just include your style file as an inline stylesheet, … Read more

Theme option : having the ability to select among several predefined headers

So first you need customizer options. You can put this in customizer.php and include that file in your functions.php or you can just put it in functions.php directly. add_action(‘customize_register’, ‘mytheme_customize_register’); function mytheme_customize_register( $wp_customize ) { /** ———————————————————— SECTION: Header ———————————————————— **/ $wp_customize->add_section(‘section_header’, array( ‘title’ => esc_html__(‘Header’, ‘mytheme’), ‘description’ => esc_attr__( ‘Choose one of three different … Read more

Outputting results from select box option in options panel

I use the same options framework plugin and this is how I specify a select menu using this framework; $test_array = array( ‘one’ => __(‘One’, ‘options_framework_theme’), ‘two’ => __(‘Two’, ‘options_framework_theme’), ‘three’ => __(‘Three’, ‘options_framework_theme’), ‘four’ => __(‘Four’, ‘options_framework_theme’), ‘five’ => __(‘Five’, ‘options_framework_theme’) ); $options[] = array( ‘name’ => __(‘Select a Tag’, ‘options_check’), ‘desc’ => __(‘Passed … Read more

WordPress Nonce and check admin referer help needed

It’s not exactly answer to your question but I suggest you check out Settings API instead. It’s not ideal (a little too verbose), but it’s very structured approach so it’s easier to get nice consistent looking form and harder to get security wrong. Chip Bennett had published thorough tutorial that shows step by step how … Read more

Theme Options page with tabs

The do_settings_section() function call needs to correspond to the $optiongroup argument you pass to register_setting(). To see how all of the myriad functions fit together, see page 10 of my tutorial. It does get fairly confusing trying to follow how the various functions string together. EDIT: You do appear to be using the option group … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)