WordPress hook source

The short answer is: There is no code that’s being excuted The long answer is: You are suppose to define that code in your own plugin space. You add a activated_plugin hook and within the callable function you specify you define the things you want to happen when your plugin is actived, ie: create database, … Read more

Error Copying Directory On Plugin Activation

That was my fault! The problem is copy_dir isn’t a WP_Filesystem method, so it cannot be called as an instance of WP_Filesystem like this: $wp_filesystem->copy_dir(), but independently like this: copy_dir(“source”, “destination”) after the WP_Filesystem() has already been called and setup. Reference copy_dir

Activation of new Registered site fails on multisite

You might have missed the right configuration in your hosts file. Assuming you are using Apache on a Linux server and vi editor, open this file: sudo vi /etc/apache2/sites-available/example.com.conf Since you have installed Multsite as subdomains, adjust your directives to include these: Listen 80 <VirtualHost *:80> DocumentRoot “/var/www/example” ServerName example.com ServerAlias *.example.com </VirtualHost> Note that … Read more

Unable to show a message after plugin activation

<?php /* Plugin Name: Activation Description: This display notice message test plugin Author: Nanhe Kumar Version: 1.0 Author URI: http://nanhe.in/ */ class Activation { public static function init() { add_action(‘admin_notices’, array(__CLASS__, ‘text_admin_notice’)); } public static function text_admin_notice() { ?> <div class=”notice notice-success is-dismissible”> <p> TEST MESSAGE</p> </div> <?php } } add_action(‘init’, array(‘Activation’, ‘init’)); Your message … Read more

On local machine can’t log in or reset password but I can log in on the live version, user has activation key in database

Your local server probably has problems sending mail. There are ways to fix that, but it is probably easiest to change the password in the database directly. Since you’ve made a copy of your site I am going to assume you have access to the database through something like PhpMyAdmin. Follow these instructions to change … Read more

How to store in the database directly the translation?

I found the solution ! The problem was I loaded plugin domain only when plugins are loaded, not for the activation plugin. It resolves my problem… MyPLugin.php class WPGroupSubs { public function __construct(){ // Install needed components on plugin activation /* need to add this */ register_activation_hook( __FILE__, array( $this, ‘load_text_domain’ ) ); register_activation_hook( __FILE__, … Read more

Redirect to custom admin menu after plugin activation

In this case, “nht_” is a prefix to avoid naming collisions with similar functions. This is a “best practice” to observe when doing your own development. So if you’re developing something that would be distributed publicly, you should be the habit of applying your own prefix to your function names; and since this particular code … Read more

Cannot modify header information – headers already sent during plugin activation

Since the standard redirection works, I figured the conflict must be with TGM plugin activation already hooking to activated_plugin and producing output and thus preventing the redirect… Therefore the solution was to ensure that the plugin activation function hook was added to an earlier priority than the (silent) default of 10 most probably used by … Read more

Redirect after plugin activation

Use WP_DEBUG to Get a List of Errors To get a readout of what PHP errors might be causing your site’s problems, you’ll need to turn on the WP_DEBUG tool. To do this, open up your wp-config.php file and add the following line of code (if it is not already present): define( ‘WP_DEBUG’, true ); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)