Tag Info

Hot answers tagged

2

I was searching for the same answer this morning for my plugin AnsPress. So I sneak into WordPress plugin wp-admin/includes/plugin.php and got an idea. WordPress check for fatal error while activating plugin, so simplest solution will be trigger a fatal error and this will prevent WordPress to activate the plugin. In my below code I check if plugin files ...


1

There is error in sql query. You have defined time as datetime and default value mentioned in current_timestamp. Define time as timestamp. Also specify length of email and page fields. Corrected query: $sql = "CREATE TABLE " . $table_name . " ( id INT NOT NULL AUTO_INCREMENT, time TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, //Change datetime to ...


1

global $langOK; add_action( 'plugins_loaded', 'myplugin_load_textdomain' ); function myplugin_load_textdomain() { global $langOK; $langOK = load_plugin_textdomain( 'my-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); } Later you can check the value of $langOK ( TRUE = success, FALSE = failure ).


1

I try this code and it solve my problem if ( is_child_theme() === false ) { // files moved } else { // do nothing } Thankx to @birgire


1

The reason is that you can register native PHP functions as callbacks. Passing more parameters to them then they expect will raise a warning. Imagine a filter that can pass 6 parameters and trim() as callback. PHP would now raise an error: Warning: Wrong parameter count for trim() in … Some custom callbacks might also change their behavior depending ...



Only top voted, non community-wiki answers of a minimum length are eligible