How to auto-upgrade my plugin?
This library integrates auto-updates for privately hosted plugins. Looks great.
This library integrates auto-updates for privately hosted plugins. Looks great.
Your menu slug (5th parameter) can’t be the same across multiple pages, and it obviously can’t have an & in it, but you can have all the pages you want call the same callback function (the last param). add_submenu_page(‘upload_manage’, “Programs”, “Programs”, ‘manage_options’, ‘manage-programs’, “manage_data”); add_submenu_page(‘upload_manage’, “Schedule”, “Schedule”, ‘manage_options’, ‘manage-schedule’, “manage_data”); Then in the manage_data function, … Read more
If you’re using Settings API, then you should use a sanitize callback: register_setting( $option_group, $option_name, $sanitize_callback ); The myth is that the $sanitize_callback actually is a filter for your options when it’s saved in the database. This is the place where you can do something with your custom code. This is the sample code: register_setting( … Read more
Create an endpoint. In the callback function for the endpoint call your plugin functions internally, so the whole WordPress environment is available and you are still on the same domain, no matter where the plugin URL is. Plus, make sure not to flush the rewrite rules on every page load, use the (de)activation hook for … Read more
WordPress will not help you here. In back-end use conservative XHTML 5: <br />, but not <figure> (see WP coding standards). In front-end … it is hard to determine the Doctype and the usage of polyfills, so stay with regular HTML as long as possible or load the necessary polyfills from your plugin.
Create a local repository in Git (or SVN) for the plugin, and each time an update happens: merge the changes into your adjusted version, test it in your local copy of the production site, then push your updated code to your site. But much better would it be to send your improvements to the plugin … Read more
WP_Query selects posts and not meta value that is way you are not getting the value. You can use the returned post ID to get the value something like: $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 1, ‘meta_key’ => ‘picture_upload_1’ ); $dbResult = new WP_Query($args); global $post; if ($dbResult->have_posts()){ $dbResult->the_post(); $value … Read more
The problem is that filters in WordPress are global; if you add a filter somewhere it persists everywhere, unless you remove it. Also consider that you should prefer composition over inheritance, and if your current application structure is already built upon inheritance, and you can’t or don’t want to change it, you should avoid at … Read more
About UPDATE+INSERT: I have made a function for myself, and might help you too, i.e. : UPDATE_OR_INSERT(‘wp_users’, array(‘gender’=>’female’), array(‘name’=>’Monika’) ); that will UPDATE A VALUE in column (where name=monika), but in case that value doesnt exists, then it creates a new record in DB. Why this is necessary? because As far as i know, there … Read more
Are you looking for a filter perhaps? add_filter( ‘the_content’, ‘wpse_the_content_filter’, 20 ); function wpse_the_content_filter( $content ) { // Do whatever you want with the $content return $content; } Filtering ‘the_content’ will pass the post or page content through a function of your choice. Just make sure to run it late (e.g. 20) and return the … Read more