How to debug register_setting callback function
The dirty and only way I’ve founded: function myplugin_validate_options($input) { var_dump($input); exit; }
The dirty and only way I’ve founded: function myplugin_validate_options($input) { var_dump($input); exit; }
The culprit is: <?php settings_errors(); ?> It isn’t needed and will produce a second “Settings saved.” notification if there are no errors. Edited for formatting.
WordPress MU uses one database and each blog gets his own tables with the blog id in the prefix, so once you install a network installation your database should have these tables: wp_1_categories wp_1_comments wp_1_link2cat wp_1_links wp_1_options wp_1_post2cat wp_1_postmeta wp_1_posts wp_blogs wp_blog_versions wp_registration_log wp_signups wp_site wp_sitecategories wp_sitemeta wp_usermeta wp_users And every new site you set … Read more
Pull the add_action() outside of the function, and put the conditional inside the callback. Also, if you’re printing a script directly, use wp_print_scripts instead of wp_head. You also have a syntax error. function testingone(){ if( get_option( ‘MyOptionName’ ) ) { ?> <script>var Script = GoesHere; </script> <?php } } add_action( ‘wp_print_scripts’,’testingone’ );
Merely having a file in the theme folder does not mean that WordPress will load the file, or that when accessed the file will be loaded in a WordPress context. There are two ways to approach this that I can think of: In order to use WordPress functions WordPress needs to load. The easiest way … Read more
For less of problems, you can use Advanced Custom Fields plugin for create a good options page , and custom fields into posts, pages, and so on. Plase check it here: http://www.advancedcustomfields.com/add-ons/options-page/ – Paid addon. Plase see a video.
Not a direct answer to your specific case but this will probably help you figure out how to do it. I found an article here: http://www.sutanaryan.com/jquery-duplicate-fields-form-submit-with-php/ which details the process of posting fields which can be repeated using jQuery. In his example he creates an HTML form: <form action=”process.php” method=”post”> <p class=”clone”> <label> Name: </label> … Read more
Usually blog settings, sidebars and plugins option are located in wp_options table. If you copy whole table except option_name IN ( ‘siteurl’, ‘home’ ), You get whole “old” configuration.
You should only need a list of URL’s selected from the Media Loader. There are others out there, but I have a Theme Options Panel for your admin that is Settings API compliant. It has an ‘upload’ option that uses the Media Loader to upload a file and fill a text field with the returned … Read more
Nevermind, answered my own question: http://www.keyframesandcode.com/resources/javascript/jQuery/demos/populate-demo.html Used that to update all the text and drop downs. Couldn’t get it to work with my checkboxes, but a few other lines of jQuery took care of those. I like the idea of just auto filling the form with the defaults, rather than submitting it right away.