global $post inside plugin query messes up every new post page in wp-admin

You have two problems in your code. You use $post as a iteration variable which is an habit best avoided You use setuppostdata which changes the global $post without you using any function that actually needs it your loop should look like foreach ( $pp_query as $p) : $pointer_query[] = array( ‘id’ => get_post_meta($p->ID, ‘_sbap_pointerid_text’, … Read more

Use plupload to upload images and save them to custom folder and database table

I managed to do it by myself thanks to this tutorial. Moved content of do.php file to a function named cmr_upload inside a class. Then changed the plupload options from: url : plugin_dir + ‘do.php’, … multipart_params : { “chapter_id”: i, “path”: path to url : ‘<?php echo admin_url(‘admin-ajax.php’) ?>’, … multipart_params : { “chapter_id”: … Read more

Foreach in get_post_types to apply a different filter per post type

Welcome to Stack exchange 🙂 Some other plugin ( or your plugin elsewhere ) may be getting executed later, and maybe adding some elements to the array. Try to give your hook a higher priority, replacing your tweak method with following… function tweak() { foreach( $this->get_post_types(‘objects’) as $type => $data) { if($this->setting(‘disable_bulk_’ . $type)) { … Read more

Why user is added back in database after deletion?

I solved this by doing something link $hook = add_menu_page(‘My Plugin Settings’,’My Plugin Settings’,’manage_options’,’my_plugin_settings’,’display_plugin_options’); add_action(‘load-‘.$hook,’do_on_my_plugin_settings_save’); function do_on_my_plugin_settings_save() { if(isset($_GET[‘settings-updated’]) && $_GET[‘settings-updated’]) { //plugin settings have been saved. Here goes your code } }