Show plugin only on a specific page

I found this function which can help u. The key is to change the handle, in this case is contact-form-7. This code snippet will prevent contact-form-7 script from loading except in contact page. add_action( ‘wp_print_scripts’, ‘my_deregister_javascript’, 100 ); function my_deregister_javascript() { if ( !is_page(‘Contact’) ) { wp_deregister_script( ‘contact-form-7’ ); } } To get this handler … Read more

$current_user var returns NULL

You need to globalize $current_user, and then populate it via get_currentuserinfo(). See the Codex entry for get_currentuserinfo(). In the Codex-example usage: <?php global $current_user; get_currentuserinfo(); ?> So, try adapting your code accordingly; e.g.: class My_plugin_class{ var $user; function __construct() { //Set the current user global $current_user; get_currentuserinfo(); $this->user = $current_user; print_r($this->user); } }

Pass $this to function nested in another public function of the same class

There are multiple ways to accomplish this. I’m showing you a way that will not fundamentally change how you are doing it: First in My_Plugin class: class My_Plugin { // … private function define_public_hooks() { $plugin_public = new My_Plugin_Public( $this->get_plugin_name(), $this->get_version() ); $this->loader->add_action( ‘init’, $plugin_public, ‘init’ ); // … } // … } Then in … Read more

WordPress plugin update not showing on wp.org [closed]

For those having this problem… It’s really rare… In most cases you will be missing something like Stable Tag: in your readme.txt file (it should be latest production-ready version). You will also need to make sure, version is correct on your main plugin .php file header. Also… version should be tagged to tags/{your_version} with svn … Read more

Adding a form at the end of the content

If I understand what you are doing, and the problem you are having, the first thing I’d try is to add your the_content filter with a large priority number so that it runs late, and hopefully after the other formatting filters. add_filter(‘the_content’,’your_callback’,100); If that doesn’t do it you may have to remove and reorder some … Read more