Get URL Parameters from referer

If tab=tab is in the URL then: global $_GET; var_dump($_GET); // debugging only; You should be able to see what you need. That is pure PHP. If your really need to process that string (I don’t know why your would) use parse_url then use parse_str on the query part of it. $path = parse_url($url); $path … Read more

Getting error to display radio button value in General Settings page

Apart from the isset issue, pointed by Rarst, there’s an error in the sanitization function. esc_attr seems not to work with radio buttons, using esc_sql does the job. You’re also missing the checked state for the buttons: add_filter( ‘admin_init’, ‘myservice_register_function’ ); function myservice_register_function() { register_setting( ‘general’, ‘my_service’, ‘esc_sql’ ); add_settings_field( ‘my_service’, ‘<label for=”service_need”>’.__(‘Do You need … Read more

Show the submitted values in the form when validation fails

You can’t. If you’re using the settings API correctly, here’s what happens when you try to save your options: Form posts to options.php WordPress handles $_POST and runs update_option on your registered settings Your sanitize callback from register_setting is applied Any data that fails/you don’t return in your callback isn’t saved WordPress redirects back to … Read more

Update problem with update_option() in combination with register_setting()

Note what happens when you provide sanitize callback in register_setting(). It register a filter to sanitize your options add_filter( “sanitize_option_{$option_name}”, $sanitize_callback ); Now when you do update_option() then trigger your own function to prevent saving 😀 Because update_option() calls $value = sanitize_option( $option, $value ); Solution: Remove register_settings() callback before you call update_option(). function gtp_remove_installing_data() … Read more

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