Blog

  • WordPress Memes

    This is the collection of all the WordPress memes I’ve created.

    You Should Make Plugins

    The West Coast Choppers meme is one of the greatest of all time. I made this for a presentation at the WordPress Lancaster meetup called How to Make a WordPress Plugin to help people get over the two biggest mental roadblocks to making their first plugin: “I don’t know PHP,” and “I don’t want to break my site.”

    Is This a PHP File?

    I made this for the same How to Make a WordPress Plugin presentation to help people understand that PHP start and end tags are what makes parts of a PHP file special, and there might be HTML or something else inside otherwise. This is slight meme abuse because the typical use of this image portrays our hero as naive.

    But Her Editors

    I made this to mock a sentence in Matt Mullenweg’s “New 5.0 Target Date” blog post that turned out to be false.

    WordPress.com is Not WordPress

    Matt Mullenweg used the wordpress.org blog to criticize one of his competitors. Which is the real post?
  • How to convert a Network Active plugin to active on each site

    WordPress multisite allows plugins and themes to be Network Active. This prevents them from being deactivated on any site in the network.

    Instructions

    To change a plugin from Network Active on every site to individually active on each site:

    1. Manually Network Deactivate the plugin from the network plugins page. The wp network command does not yet support plugin deactivation.

    2. Connect to the server via SSH and run this WP CLI command. In this example, superlist-block/superlist-block.php is the plugin basename.

      wp site list --field=url | xargs -n1 -I % wp --url=% plugin activate superlist-block/superlist-block.php

    What does the command do?

    wp site list --field=url produces a list of URLs for all of the sites on the network.

    The | operator passes the results from wp site list to xargs. xargs can take the output from one command and send it to another command as parameters.

    The -n1 flag to xargs processes each line of output from the site list command one at a time. -n2 would send two site URLs to the next command.

    wp --url=% plugin activate hello.php is the command to which xargs is passing the site URLs. It activates the Hello Dolly plugin on each site specified by URL. The % sign is our replacement character where each URL will populate.

    A for loop might be easier to read

    If this code is easier to quickly read and comprehend, read Sal Ferrarello’s post, Loop Through WordPress Multisite Blogs with WP CLI.

    for URL in $(wp site list --field=url); do 
      wp plugin activate superlist-block/superlist-block.php --url=$URL;
    done