Hide One Of The October Rainlab Blog Categories?

- 1 answer

How to hide one of the October Rainlab Blog categories? One of the categories should not be displayed in the Categories List on page. I want to use one hidden category only for filtering and display special posts on HomePage. Any ideas?



I am not sure what do you mean by "hide" here. but I guess you Don't want to Display it on Front-end (by Default)

You can extend Category model to do that.

if you have relative plugin / or / create your own plugin and in Plugin.php file define/override boot method and you can define something like this

use App;
use October\Rain\Database\Builder;

[...other code ...]

public function boot(){

    \RainLab\Blog\Models\Category::extend(function($model) {
        // App::runningInBackend() you can also use this one to make sure it will 
        // execute on frontend only
        if(!App::runningInBackend()) {
            $model::addGlobalScope('id', function(Builder $builder) {
                $builder->where('id', '!=', 2);

Now, at the front-end side it will not show the categorie which is having id => 2

May be this can help you and If you need anything else please comment. For plugin related details you can check here :