Articles of activation

Only allow plugin to be activated on root site of multisite

I’m developing the wordpress file monitor plus plugin. Its purpose is to scan for altered files and it works fine for a single installation of WP. But when you look at multi-site it’s not something that wants to be enabled on all sub sites, as they all share the same files and (to be honest) […]

Automatically install wordpress plugin at theme activation

I’m looking into using http://tgmpluginactivation.com/ to activate required plugins for my custom theme during the theme activation step. From what I can tell, this class only Activates plugins automatically, but it doesn’t automatically Install plugins I have bundled with my theme. Does anyone know if it’s possible to automatically Install plugins upon theme activation? Preferably, […]

Default Plugin Settings Not Writing to Database

I have my plugin setup as such: Main plugin file mouldings.php <?php /* Plugin Name: Moulding Profiles Plugin URI: Description: Creates a ‘Moulding Profiles’ and ‘Idea Gallery’ custom post type, creates a ‘Wood Types’ and ‘Categories’ taxonomy for ‘Moulding Profiles’ Version: 0.1 Author: Author URI: License: GPL2 */ // Global Variables $mouldings_prefix = ‘mouldings_’; $mouldings_name […]

Comments deactivated

I can’t write comments to new articles (no add comment link available). I use WordPress 3.4. I checked the discussion properties and they are set to allow guests to comment articles none of the other (relevant) options are checked I have the feeling that comments aren’t available since I installed some plugins. But I tried […]

is_plugin_active() not properly returning true

I have a plugin activated and working, and I installed and activated another plugin I wrote to communicate with it. However when I run is_plugin_active() I get false returned – does anyone have any idea why and how to rectify it? EDIT: some basic code. I am in the admin area, and I’m trying to […]

Unexpected Output: register_activation_hook with namespace

I encounter a weird error while using the register_activation_hook and namespace. The plugin generated 236 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin. I get this error even with this simple plugin: <?php /** * Plugin Name: […]

Auto add content such as pages upon plugin activation?

I’m creating my first plugin and it requires some pages with content to functionally work properly. I was wondering if it is possible to show a message like “Click here to automatically add the required pages for this plugin” in the wordpress plugins area. So when the user activates the plugin this message will show […]

Force plugin to fail activation

I’m writing a plugin that will be using custom fields added by a theme. Because of this, it would be ideal if my plugin not be able to activate should these fields not exist. How do I go about displaying an error and forcing the activation to fail?

How to create a page when a theme is activated?

I want my theme to have an ‘about’ page available by default when a user uses my theme. Is there a way to auto create a page when a user selects your template? Or some other way of achieving this?

Override pluggable functions in a plugin?

WordPress has a file called pluggable.php which contains a list of functions you can override in your plugin. The problem I am facing (I am overriding wp_authenticate) is for each blog in my network I try to activate this plugin, I get: failure, can’t re-declare wp_authenticate which was previously declared in pluggable.php This somewhat defeats […]