Skip to content

tsubotitsch/WordPressPS

WordPressPS - A PowerShell Module for WordPress REST API

WordPressPS Logo

PowerShell Gallery Version PowerShell Gallery Downloads Platform GitHub Issues

PowerShell module for managing the WordPress site

For detailed API reference, see the WordPress REST API documentation.

Functions

Category Function Name
Authentication Connect-WordPress
Users Get-WordPressUser, New-WordPressUser, Remove-WordPressUser, Update-WordPressUser
Media Get-WordPressMedia, New-WordPressMedia, Remove-WordPressMedia, Update-WordPressMedia
Pages Get-WordPressPage
Posts Get-WordPressPost, Remove-WordPressPost
Plugins Get-WordPressPlugin

First Steps

Creating an application password and connecting to your WordPress site

First, you'll need an application password for your WordPress account:

  1. Log in to your WordPress admin dashboard.
  2. Navigate to User > > Application Passwords.
  3. Click on "Add New".
  4. Fill in the application name.
  5. Copy the generated password and store it securely, as you won't be able to see it again.
  6. You can use the Connect-WordPress function to establish a connection using your API credentials.

Getting Started with the Module

# PowerShellGet 2.x
#Install-Module -Name WordPressPS -Repository PSGallery

# PowerShellGet 3.x
Install-PSResource -Name WordPressPS

Import-Module WordPressPS

# List all available cmdlets provided by the module
Get-Command -Module WordPressPS

# Connect to your WordPress site using application password
$credential = Get-Credential -Message "Enter your username/application password"
Connect-WordPress -Credential $credential -SiteUrl "https://yourwordpress.com"

# List existing users
Get-WordPressUser | Select-Object id, slug, name, description| Format-Table

# Get existing media items
Get-WordPressMedia | Select-Object id, media_type,slug,alt_text,modified| Format-Table                                                                                                                                                                        

# List posts
Get-WordPressPost | Select-Object id, slug, status, modified, @{Name='title.rendered'; Expression = { $_.title.rendered }} | Format-Table

# Get installed plugins
Get-WordPressPlugin | Select-Object version, plugin, name, author, status| Format-Table

About

PowerShell module for managing WordPress

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors