Wvnderlab - Disable Posts
🔌 A simple WordPress mu-plugin to disable posts.
by Wvnderlab Agency · github.com/wvnderlab-agency/wp-disable-posts · website
★ 1stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/wvnderlab-agency/wp-disable-posts/archive/refs/heads/master.zipInstallation
Via Composer
composer require wvnderlab-agency/wp-disable-posts
Via FTP
- Download the repository zip file.
- Unzip the file.
- Upload the unzipped folder to the
/wp-content/mupluginsor/wp-content/plugins/directory on your server. - Navigate to the 'Plugins' section in your WordPress admin dashboard.
- Find 'Disable posts' in the list and click 'Activate'.
Via WordPress Admin Dashboard
- Download the repository zip file.
- Navigate to the 'Plugins' section in your WordPress admin dashboard.
- Click 'Add New' and then 'Upload Plugin'.
- Choose the downloaded zip file and click 'Install Now'.
- After installation, click 'Activate Plugin'.
Usage
Filter Hooks
wvnderlab/disable-posts/enabled (Default: true)
This filter allows you to disable the plugin functionality.
// disable the plugin functionality
add_filter( 'wvnderlab/disable-posts/enabled', '__return_false' );
wvnderlab/disable-posts/status-code (Default: 404)
This filter allows you to set the HTTP status code returned when posts are disabled.
You can set it to standard codes like 404 (Not Found), 410 (Gone), or redirect codes like 301 (Moved Permanently) or 302 (Found).
// set the status code to 301 - Moved Permanently
add_filter( 'wvnderlab/disable-posts/status-code', fn() => 301 );
// set the status code to 302 - Found
add_filter( 'wvnderlab/disable-posts/status-code', fn() => 302 );
// set the status code to 307 - Temporary Redirect
add_filter( 'wvnderlab/disable-posts/status-code', fn() => 307 );
// set the status code to 308 - Permanent Redirect
add_filter( 'wvnderlab/disable-posts/status-code', fn() => 308 );
// set the status code to 410 - Gone
add_filter( 'wvnderlab/disable-posts/status-code', fn() => 410 );
wvnderlab/disable-posts/redirect-url (Default: home_url())
This filter allows you to override the redirect URL when posts are disabled and the wvnderlab/disable-posts/status-code filter is set to use a redirect status code (e.g., 301 or 302).
// override the redirect URL
add_filter( 'wvnderlab/disable-posts/redirect_url', 'YOUR_REDIRECT_URL' );
Development
Install Dependencies
composer install
Analyse Code-Quality with WP-Coding-Standards
composer analyze
Refactor Code along WP-Coding-Standards
composer refactor