creating pages on each current blog site on plugin activation

I am on a project which will create pages while activating the plugin. But it is creating on existing main blog site. It also want to create in existing blog sites automatically on plugin activation.

$query = $wpdb->get_results("SELECT blog_id FROM $wpdb->blogs");

foreach($query as $result) {



Please help!


Check out plugin activation hook

Please, also, review your message, it is unclear.

Tags: Wordpress / Plugins

Similar questions

Wordpress Create pages on theme activation - add child pages using this function
I am using this function to add new pages on theme activation: Using up this snippet and I am wanting to create quite a few pages. I.e What I would like to know is how to set the post parent on the child pages? It seems as though the post parent is set with 'post_parent' => [ ] // Sets the parent of the new post, if any. Default 0. But say I am add...
Wordpress Select Template for Each Page on Activation
So, I have wordpress multisite. I want my users to be able to activate a new theme, and still have their content in place. The problem I am having is, everytime a new theme is activated, each page's template selection is updated to the 'default' template. I would like for example, the Home Page to keep the home-page.php template etc... I have tried...
Creating Tables on Network Activation
I'm working on a plugin which creates a new table. I've got it working fine on a single site install, but I'm not so sure about multisite. How do I create a table for each blog on network activation?
Send user activation email when programmatically creating user
I wondered if someone here might be able to help. Basically, I've created a custom registration form that when validated, inserts a user to the user table. Now, what I need it to do is rather than sent the confirmation e-mail which I know I can do with the following code. I want to send a user activation e-mail instead. I've tried a few things but ...
Activation hook not creating table
For some reason my activation hook is not creating new database table. Code:
Creating two tables in database on activation hook
I have been trying to generate two tables in database on activation hook. But it generates only the first one table on activation hook . What am i doing wrong in my code?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.