| | |
| | | class HideSingle { |
| | | protected string $slug; |
| | | protected string $postType; |
| | | protected Registrar $registrar; |
| | | public function __construct(string $slug, Registrar $registrar) { |
| | | $this->slug = $slug; |
| | | $this->postType = jvbCheckBase($slug); |
| | | $this->registrar = $registrar; |
| | | |
| | | if ($this->registrar->hasFeature('hide_single')) { |
| | | |
| | | if ($registrar->hasFeature('hide_single')) { |
| | | add_filter('is_post_type_viewable', [$this, 'hideFromPublic']); |
| | | if ($this->registrar->hasFeature('redirect_to_author')) { |
| | | if ($registrar->hasFeature('redirect_to_author')) { |
| | | add_filter('post_type_link', [$this, 'redirectSingleToAuthor'], 15, 2); |
| | | add_action('template_redirect', [$this, 'actuallyRedirectToAuthor']); |
| | | } else { |