PluginProbe
My WP Customize Admin/Frontend / 1.5
My WP Customize Admin/Frontend v1.5
1.27.4 1.27.3 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.10 1.10.1 1.10.2 1.11 1.12 1.12.1 1.12.2 1.13 1.13.1 1.13.2 1.14 1.15.0 1.16 1.17.0 All 76 releases
my-wp / controller / modules / mywp.controller.module.frontend.author-archive.php

mywp.controller.module.frontend.author-archive.php in My WP Customize Admin/Frontend 1.5, at controller/modules/mywp.controller.module.frontend.author-archive.php

84 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 if( ! class_exists( 'MywpControllerAbstractModule' ) ) {
8 return false;
9 }
10
11 if ( ! class_exists( 'MywpControllerModuleFrontendAuthorArchive' ) ) :
12
13 final class MywpControllerModuleFrontendAuthorArchive extends MywpControllerAbstractModule {
14
15 static protected $id = 'frontend_author_archive';
16
17 public static function mywp_controller_initial_data( $initial_data ) {
18
19 $initial_data['disable_archive'] = '';
20
21 return $initial_data;
22
23 }
24
25 public static function mywp_controller_default_data( $default_data ) {
26
27 $default_data['disable_archive'] = false;
28
29 return $default_data;
30
31 }
32
33 public static function mywp_wp_loaded() {
34
35 if( is_admin() ) {
36
37 return false;
38
39 }
40
41 if( ! self::is_do_controller() ) {
42
43 return false;
44
45 }
46
47 add_action( 'pre_get_posts' , array( __CLASS__ , 'disable_archive' ) );
48
49 }
50
51 public static function disable_archive( $wp_query ) {
52
53 if( ! self::is_do_function( __FUNCTION__ ) ) {
54
55 return $wp_query;
56
57 }
58
59 if( empty( $wp_query->is_author ) ) {
60
61 return $wp_query;
62
63 }
64
65 $setting_data = self::get_setting_data();
66
67 if( empty( $setting_data['disable_archive'] ) ) {
68
69 return $wp_query;
70
71 }
72
73 $wp_query->set_404();
74
75 self::after_do_function( __FUNCTION__ );
76
77 }
78
79 }
80
81 MywpControllerModuleFrontendAuthorArchive::init();
82
83 endif;
84