Skip to content

Instantly share code, notes, and snippets.

@Nerdies24
Last active December 24, 2021 05:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nerdies24/af0d556500ac1a27d9e91ae9f350bc67 to your computer and use it in GitHub Desktop.
Save Nerdies24/af0d556500ac1a27d9e91ae9f350bc67 to your computer and use it in GitHub Desktop.
WP CLI mit Xampp unter Windows

WP CLI installieren

  • Downloade CLI - https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
  • kürze die gedownloadete Datei auf wp und speichere sie unter c:
  • Rechtsklick Windows Symbol / System
  • Suche nach "Umgebungsvariablen"
  • Umgebungsvariablen für dieses Konto bearbeiten
  • Klicke auf path / bearbeiten / neu
  • Trage ein c:\xampp\php => abspeichern
  • Gebe unter c: => php c:\wp --info in die Powershell ein

Installiere Xampp

Installiere WordPress mit der WP CLI

WP CLI Code

php c:\wp core download --locale=de_DE --skip-content --force
php c:/wp config create --dbhost=localhost --dbname=nerdies234 --dbuser=root --dbpass= --dbprefix=nerdies234_wp_ --locale=de_DE --dbcollate=utf8mb4_unicode_ci --skip-check
php c:/wp core install --url=localhost/nerdies234 --title=CLI-Demo --admin_user=admin --admin_password=Pass@123 --admin_email=demotest1090@gmail.com
php c:\wp option update blogdescription "CLI Demo"
php c:\wp post delete 1 --force
php c:\wp post delete 2 --force
php c:\wp post delete 3 --force
php c:\wp theme install generatepress --activate
php c:\wp theme install https://generatepress.com/api/themes/generatepress_child.zip 
php c:\wp plugin install generateblocks
php c:\wp plugin install safe-svg
php c:\wp plugin install wp-sweep --activate
php c:\wp post create --post_type=page --post_status=publish --post_title='Home' --post_content='Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.'
php c:\wp post create --post_type=page --post_status=publish --post_title='Blog'
php c:\wp post create --post_type=page --post_status=publish --post_title='Über mich' --post_content='Schreibe hier etwas über Dich'
php c:\wp post create --post_type=page --post_status=publish --post_title='Kontakt' --post_content='Hier kommt das Kontaktformular mit dem Plugin Contact Form 7'
php c:\wp post create --post_type=page --post_status=publish --post_title='Impressum' --post_content='Füge hier Dein Impressum ein. Generiere Dir am Besten eins von E-Recht24'
php c:\wp post create --post_type=page --post_status=publish --post_title='Datenschutz' --post_content='Füge hier Deine Datenschutzerklärung ein. Generiere Dir am Besten eins von E-Recht24'
php c:\wp post create --post_type=page --post_status=publish --post_title='Bildnachweise' --post_content='Füge hier Deine Bildnachweise ein. Dies ist ein wichtiger Punkt, wenn Du fremde Bilder laden möchtest.'
php c:\wp post create --post_type=post --post_status=publish --comment_status=open --post_title='Der erste WordPress Beitrag' --post_content='Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.'
php c:\wp menu create "Hauptmenu"
php c:\wp menu location assign hauptmenu primary
php c:\wp menu item add-post hauptmenu 4
php c:\wp menu item add-post hauptmenu 5
php c:\wp menu item add-post hauptmenu 6
php c:\wp menu item add-post hauptmenu 7
php c:\wp option update page_on_front 4
php c:\wp option update show_on_front page
php c:\wp option update timezone_string "Europe/Berlin"
php c:\wp option update time_format "G:i"
php c:\wp option update start_of_week 1
php c:\wp option update date_format "j. F Y"
php c:\wp option update show_avatars 0
php c:\wp option update use_smilies 0
php c:\wp option get permalink_structure
php c:\wp option update permalink_structure '/%postname%/'
php c:\wp cache flush

GeneratePress Premium Module aktivieren

php c:\wp option update generate_package_backgrounds 'activated'
php c:\wp option update generate_package_blog 'activated'
php c:\wp option update generate_package_colors 'activated'
php c:\wp option update generate_package_copyright 'activated'
php c:\wp option update generate_package_disable_elements 'activated'
php c:\wp option update generate_package_elements 'activated'
php c:\wp option update generate_package_hooks 'activated'
php c:\wp option update generate_package_menu_plus 'activated'
php c:\wp option update generate_package_page_header 'activated'
php c:\wp option update generate_package_secondary_nav 'activated'
php c:\wp option update generate_package_sections 'activated'
php c:\wp option update generate_package_site_library 'activated'
php c:\wp option update generate_package_spacing 'activated'
php c:\wp option update generate_package_typography 'activated'

Debug anschalten

php c:\wp config set --raw WP_DEBUG true
php c:\wp config set --raw WP_DEBUG_LOG true
php c:\wp config set --raw WP_DEBUG_DISPLAY false

Plugins und Themes updaten

php c:\wp plugin --all update
php c:\wp theme --all update

Wordpress Core Update

php c:\wp core update
php c:\wp language core update

Plugins und Themes Sprachdateien updaten

php c:\wp language plugin --all update
php c:\wp language theme --all update

Memory Limit auf 512MB hochsetzen

php c:\wp config set WP_MEMORY_LIMIT 512M

Transienten löschen

php c:\wp transient delete --all

WP CLI Update Check

php c:\wp cli check-update

Fake User anlegen (nur Benutzer-ID - ohne Zuweisung eines Passworter)

php c:\wp user create nerdies1 1fake1@gmail.com --role=subscriber --porcelain
php c:\wp user create nerdies2 2fake2@gmail.com --role=editor --porcelain
php c:\wp user create nerdies3 3fake3@gmail.com --role=author --porcelain
php c:\wp user create nerdies4 4fake4@gmail.com --role=contributor --porcelain

Fake User Bob mit Passwort erstellen (Passwort wird generiert)

php c:\wp user create bob bob@example.com --role=author

Fake User Karl mit direkter Passwort Zuweisung (karl123)

php c:\wp user create karl karl@example.com --role=author --user_pass=karl123

Cache löschen

php c:\wp cache flush

Datenbank Tabellen Größen

php c:\wp db size --tables

Cron Jobs anzeigen

php c:\wp cron event list

Benutzerdefiniertes Plugin erstellen und aktivieren

php c:\wp scaffold plugin "Nerdies24-Spezial" --plugin_description=EIN-NERDIES24.DE-PLUGIN --plugin_author="Frank Noack" --plugin_author_uri=https://nerdies24.de --plugin_uri=https://nerdies24.de --skip-tests --activate

Dieser Gist gehört zur Facebook Gruppe: https://www.facebook.com/groups/deinwordpressprojekt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment