is_admin example

if (
        isset( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] &&
        ( ! empty( $_GET['wp_lang'] ) || ! empty( $_COOKIE['wp_lang'] ) )
    ) {
        if ( ! empty( $_GET['wp_lang'] ) ) {
            $determined_locale = sanitize_locale_name( $_GET['wp_lang'] );
        } else {
            $determined_locale = sanitize_locale_name( $_COOKIE['wp_lang'] );
        }
    } elseif (
        is_admin() ||
        ( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() )
    ) {
        $determined_locale = get_user_locale();
    }

    if ( ! $determined_locale ) {
        $determined_locale = get_locale();
    }

    /** * Filters the locale for the current request. * * @since 5.0.0 * * @param string $locale The locale. */

    );
    $args     = wp_parse_args( $args$defaults );
    if ( $menu->count > 0 ) {
        $items = get_posts( $args );
    } else {
        $items = array();
    }

    $items = array_map( 'wp_setup_nav_menu_item', $items );

    if ( ! is_admin() ) { // Remove invalid items only on front end.         $items = array_filter( $items, '_is_valid_nav_menu_item' );
    }

    if ( ARRAY_A === $args['output'] ) {
        $items = wp_list_sort(
            $items,
            array(
                $args['output_key'] => 'ASC',
            )
        );

        

function _post_format_request( $qvs ) {
    if ( ! isset( $qvs['post_format'] ) ) {
        return $qvs;
    }
    $slugs = get_post_format_slugs();
    if ( isset( $slugs[ $qvs['post_format'] ] ) ) {
        $qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ];
    }
    $tax = get_taxonomy( 'post_format' );
    if ( ! is_admin() ) {
        $qvs['post_type'] = $tax->object_type;
    }
    return $qvs;
}

/** * Filters the post format term link to remove the format prefix. * * @access private * @since 3.1.0 * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @param string $link * @param WP_Term $term * @param string $taxonomy * @return string */


    /* * If any of the above options failed, Fallback on the GUID as used pre-2.7, * not recommended to rely upon this. */
    if ( ! $url ) {
        $url = get_the_guid( $post->ID );
    }

    // On SSL front end, URLs should be HTTPS.     if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow ) {
        $url = set_url_scheme( $url );
    }

    /** * Filters the attachment URL. * * @since 2.1.0 * * @param string $url URL for the given attachment. * @param int $attachment_id Attachment post ID. */
    
if ( ! isset( $GLOBALS['wp_locale'] ) && function_exists( 'load_default_textdomain' ) ) {
                load_default_textdomain();
            }

            $handled = false;

            if ( ! is_multisite() && wp_recovery_mode()->is_initialized() ) {
                $handled = wp_recovery_mode()->handle_error( $error );
            }

            // Display the PHP error template if headers not sent.             if ( is_admin() || ! headers_sent() ) {
                $this->display_error_template( $error$handled );
            }
        } catch ( Exception $e ) {
            // Catch exceptions and remain silent.         }
    }

    /** * Detects the error causing the crash if it should be handled. * * @since 5.2.0 * * @return array|null Error information returned by `error_get_last()`, or null * if none was recorded or the error should not be handled. */
$domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) );
    if ( str_ends_with( $domain, ':80' ) ) {
        $domain               = substr( $domain, 0, -3 );
        $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );
    } elseif ( str_ends_with( $domain, ':443' ) ) {
        $domain               = substr( $domain, 0, -4 );
        $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );
    }

    $path = stripslashes( $_SERVER['REQUEST_URI'] );
    if ( is_admin() ) {
        $path = preg_replace( '#(.*)/wp-admin/.*#', '$1/', $path );
    }
    list( $path ) = explode( '?', $path );

    $bootstrap_result = ms_load_current_site_and_network( $domain$pathis_subdomain_install() );

    if ( true === $bootstrap_result ) {
        // `$current_blog` and `$current_site are now populated.     } elseif ( false === $bootstrap_result ) {
        ms_not_installed( $domain$path );
    } else {
        
$this->init();
        add_action( 'init', array( $this, 'init' ), 0 );
    }

    /** * Initialize the class. * * @since 3.4.0 */
    public function init() {
        if (
            function_exists( 'is_admin' ) && ! is_admin()
        &&
            function_exists( 'current_theme_supports' ) && ! current_theme_supports( 'html5', 'script' )
        ) {
            $this->type_attr = " type='text/javascript'";
        }

        /** * Fires when the WP_Scripts instance is initialized. * * @since 2.6.0 * * @param WP_Scripts $wp_scripts WP_Scripts instance (passed by reference). */
echo apply_filters(
            'akismet_comment_form_privacy_notice_markup',
            '<p class="akismet_comment_form_privacy_notice">' . sprintf(
                __( 'This site uses Akismet to reduce spam. <a href="%s" target="_blank" rel="nofollow noopener">Learn how your comment data is processed</a>.', 'akismet' ),
                'https://akismet.com/privacy/'
            ) . '</p>'
        );
    }

    public static function load_form_js() {
        if (
            ! is_admin()
            && ( ! function_exists( 'amp_is_request' ) || ! amp_is_request() )
            && self::get_api_key()
            ) {
            wp_register_script( 'akismet-frontend', plugin_dir_url( __FILE__ ) . '_inc/akismet-frontend.js', array()filemtime( plugin_dir_path( __FILE__ ) . '_inc/akismet-frontend.js' ), true );
            wp_enqueue_script( 'akismet-frontend' );
        }
    }

    /** * Add the form JavaScript when we detect that a supported form shortcode is being parsed. */
    

function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
    _deprecated_function( __FUNCTION__, '3.3.0' );

    $user_id = get_current_user_id();

    if ( 0 != $user_id ) {
        if ( is_admin() )
            $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
        elseif ( is_multisite() )
            $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
        else
            $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
    }
}

/** * Checks if the current user belong to a given site. * * @since MU (3.0.0) * @deprecated 3.3.0 Use is_user_member_of_blog() * @see is_user_member_of_blog() * * @param int $blog_id Site ID * @return bool True if the current users belong to $blog_id, false if not. */


    /** * Ensures widgets are available for all types of previews. * * When in preview, hook to {@see 'customize_register'} for settings after WordPress is loaded * so that all filters have been initialized (e.g. Widget Visibility). * * @since 3.9.0 */
    public function schedule_customize_register() {
        if ( is_admin() ) {
            $this->customize_register();
        } else {
            add_action( 'wp', array( $this, 'customize_register' ) );
        }
    }

    /** * Registers Customizer settings and controls for all sidebars and widgets. * * @since 3.9.0 * * @global array $wp_registered_widgets * @global array $wp_registered_widget_controls * @global array $wp_registered_sidebars */
'args'                  => null,
            '_builtin'              => false,
        );

        $args = array_merge( $defaults$args );

        // If not set, default to the setting for 'public'.         if ( null === $args['publicly_queryable'] ) {
            $args['publicly_queryable'] = $args['public'];
        }

        if ( false !== $args['query_var'] && ( is_admin() || false !== $args['publicly_queryable'] ) ) {
            if ( true === $args['query_var'] ) {
                $args['query_var'] = $this->name;
            } else {
                $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] );
            }
        } else {
            // Force 'query_var' to false for non-public taxonomies.             $args['query_var'] = false;
        }

        if ( false !== $args['rewrite'] && ( is_admin() || get_option( 'permalink_structure' ) ) ) {
            

    );
}
add_action( 'init', 'register_block_core_post_excerpt' );

/** * If themes or plugins filter the excerpt_length, we need to * override the filter in the editor, otherwise * the excerpt length block setting has no effect. * Returns 100 because 100 is the max length in the setting. */
if ( is_admin() ||
    defined( 'REST_REQUEST' ) && REST_REQUEST ) {
    add_filter(
        'excerpt_length',
        static function() {
            return 100;
        },
        PHP_INT_MAX
    );
}


        if ( '' != $qv['paged'] && ( (int) $qv['paged'] > 1 ) ) {
            $this->is_paged = true;
        }

        // If we're previewing inside the write screen.         if ( '' != $qv['preview'] ) {
            $this->is_preview = true;
        }

        if ( is_admin() ) {
            $this->is_admin = true;
        }

        if ( str_contains( $qv['feed'], 'comments-' ) ) {
            $qv['feed']         = str_replace( 'comments-', '', $qv['feed'] );
            $qv['withcomments'] = 1;
        }

        $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;

        if ( $this->is_feed && ( ! empty( $qv['withcomments'] ) || ( empty( $qv['withoutcomments'] ) && $this->is_singular ) ) ) {
            
$pagenum = (int) $pagenum;

    $request = remove_query_arg( 'paged' );

    $home_root = parse_url( home_url() );
    $home_root = ( isset( $home_root['path'] ) ) ? $home_root['path'] : '';
    $home_root = preg_quote( $home_root, '|' );

    $request = preg_replace( '|^' . $home_root . '|i', '', $request );
    $request = preg_replace( '|^/+|', '', $request );

    if ( ! $wp_rewrite->using_permalinks() || is_admin() ) {
        $base = trailingslashit( get_bloginfo( 'url' ) );

        if ( $pagenum > 1 ) {
            $result = add_query_arg( 'paged', $pagenum$base . $request );
        } else {
            $result = $base . $request;
        }
    } else {
        $qs_regex = '|\?.*?$|';
        preg_match( $qs_regex$request$qs_match );

        

    if ( is_preview() && get_query_var( 'p' ) && 'publish' === get_post_status( get_query_var( 'p' ) ) ) {
        if ( ! isset( $_GET['preview_id'] )
            || ! isset( $_GET['preview_nonce'] )
            || ! wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'] )
        ) {
            $wp_query->is_preview = false;
        }
    }

    if ( is_admin() || is_search() || is_preview() || is_trackback() || is_favicon()
        || ( $is_IIS && ! iis7_supports_permalinks() )
    ) {
        return;
    }

    if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) {
        // Build the URL in the address bar.         $requested_url  = is_ssl() ? 'https://' : 'http://';
        $requested_url .= $_SERVER['HTTP_HOST'];
        $requested_url .= $_SERVER['REQUEST_URI'];
    }

    
Home | Imprint | This part of the site doesn't use cookies.