is_wp_error example

case 'remove':
                    $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __( 'User removed from this site.' ) . '</p></div>';
                    break;
                case 'err_admin_remove':
                    $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'You cannot remove the current user.' ) . '</p></div>';
                    $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __( 'Other users have been removed.' ) . '</p></div>';
                    break;
            }
        endif;
        ?> <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?> <div class="error"> <ul> <?php                 foreach ( $errors->get_error_messages() as $err ) {
                    echo "<li>$err</li>\n";
                }
                ?> </ul> </div> <?php         endif;

        
if ( false !== $this->timeout ) {
            $args['timeout'] = $this->timeout;
        }

        // Now send the request.         if ( $this->debug ) {
            echo '<pre class="ixr_request">' . htmlspecialchars( $xml ) . "\n</pre>\n\n";
        }

        $response = wp_remote_post( $url$args );

        if ( is_wp_error( $response ) ) {
            $errno       = $response->get_error_code();
            $errorstr    = $response->get_error_message();
            $this->error = new IXR_Error( -32300, "transport error: $errno $errorstr);
            return false;
        }

        if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
            $this->error = new IXR_Error( -32301, 'transport error - HTTP status code was not 200 (' . wp_remote_retrieve_response_code( $response ) . ')' );
            return false;
        }

        
$update_actions['activate'] = sprintf(
                    '<a href="%s" class="activatelink">' .
                    '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
                    esc_url( $activate_link ),
                    __( 'Activate' ),
                    /* translators: Hidden accessibility text. %s: Theme name. */
                    sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' )$name )
                );
            }

            if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() ) {
                unset( $update_actions['preview']$update_actions['activate'] );
            }
        }

        $update_actions['themes_page'] = sprintf(
            '<a href="%s" target="_parent">%s</a>',
            self_admin_url( 'themes.php' ),
            __( 'Go to Themes page' )
        );

        /** * Filters the list of action links available following a single theme update. * * @since 2.8.0 * * @param string[] $update_actions Array of theme action links. * @param string $theme Theme directory name. */
$this->key_service->clean_expired_keys( $this->get_link_ttl() );
    }

    /** * Handles checking for the recovery mode cookie and validating it. * * @since 5.2.0 */
    protected function handle_cookie() {
        $validated = $this->cookie_service->validate_cookie();

        if ( is_wp_error( $validated ) ) {
            $this->cookie_service->clear_cookie();

            $validated->add_data( array( 'status' => 403 ) );
            wp_die( $validated );
        }

        $session_id = $this->cookie_service->get_session_id_from_cookie();
        if ( is_wp_error( $session_id ) ) {
            $this->cookie_service->clear_cookie();

            $session_id->add_data( array( 'status' => 403 ) );
            
'posts_per_page'      => 1,
                'no_found_rows'       => true,
                'lazy_load_term_meta' => false, // Do not lazy load term meta, as template parts only have one term.             )
        );
        $template_part_post  = $template_part_query->have_posts() ? $template_part_query->next_post() : null;
        if ( $template_part_post ) {
            // A published post might already exist if this template part was customized elsewhere             // or if it's part of a customized template.             $content    = $template_part_post->post_content;
            $area_terms = get_the_terms( $template_part_post, 'wp_template_part_area' );
            if ( ! is_wp_error( $area_terms ) && false !== $area_terms ) {
                $area = $area_terms[0]->name;
            }
            /** * Fires when a block template part is loaded from a template post stored in the database. * * @since 5.9.0 * * @param string $template_part_id The requested template part namespaced to the theme. * @param array $attributes The block attributes. * @param WP_Post $template_part_post The template part post object. * @param string $content The template part content. */
// Self-URL destruction sequence.         if ( in_array( untrailingslashit( $url ), array( site_url()home_url() ), true ) ) {
            return;
        }

        $rss   = fetch_feed( $url );
        $title = $instance['title'];
        $desc  = '';
        $link  = '';

        if ( ! is_wp_error( $rss ) ) {
            $desc = esc_attr( strip_tags( html_entity_decode( $rss->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) );
            if ( empty( $title ) ) {
                $title = strip_tags( $rss->get_title() );
            }
            $link = strip_tags( $rss->get_permalink() );
            while ( ! empty( $link ) && stristr( $link, 'http' ) !== $link ) {
                $link = substr( $link, 1 );
            }
        }

        if ( empty( $title ) ) {
            
/** * Checks if a request has access to read or edit the specified term. * * @since 4.7.0 * * @param WP_REST_Request $request Full details about the request. * @return true|WP_Error True if the request has read access for the item, otherwise false or WP_Error object. */
    public function get_item_permissions_check( $request ) {
        $term = $this->get_term( $request['id'] );

        if ( is_wp_error( $term ) ) {
            return $term;
        }

        if ( 'edit' === $request['context'] && ! current_user_can( 'edit_term', $term->term_id ) ) {
            return new WP_Error(
                'rest_forbidden_context',
                __( 'Sorry, you are not allowed to edit this term.' ),
                array( 'status' => rest_authorization_required_code() )
            );
        }

        
$site_id = (int) $site_id;
        if ( ! $site_id ) {
            return false;
        }

        $_site = wp_cache_get( $site_id, 'sites' );

        if ( false === $_site ) {
            $_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d LIMIT 1", $site_id ) );

            if ( empty( $_site ) || is_wp_error( $_site ) ) {
                $_site = -1;
            }

            wp_cache_add( $site_id$_site, 'sites' );
        }

        if ( is_numeric( $_site ) ) {
            return false;
        }

        return new WP_Site( $_site );
    }

function _wp_get_allowed_postdata( $post_data = null ) {
    if ( empty( $post_data ) ) {
        $post_data = $_POST;
    }

    // Pass through errors.     if ( is_wp_error( $post_data ) ) {
        return $post_data;
    }

    return array_diff_key( $post_dataarray_flip( array( 'meta_input', 'file', 'guid' ) ) );
}

/** * Updates an existing post with values provided in `$_POST`. * * If post data is passed as an argument, it is treated as an array of data * keyed appropriately for turning into a post object. * * If post data is not passed, the `$_POST` global variable is used instead. * * @since 1.5.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @param array|null $post_data Optional. The array of post data to process. * Defaults to the `$_POST` superglobal. * @return int Post ID. */


    /* * Template slugs must be unique within the same theme. * TODO - Figure out how to update this to work for a multi-theme environment. * Unfortunately using `get_the_terms()` for the 'wp-theme' term does not work * in the case of new entities since is too early in the process to have been saved * to the entity. So for now we use the currently activated theme for creation. */
    $theme = get_stylesheet();
    $terms = get_the_terms( $post_id, 'wp_theme' );
    if ( $terms && ! is_wp_error( $terms ) ) {
        $theme = $terms[0]->name;
    }

    $check_query_args = array(
        'post_name__in'  => array( $override_slug ),
        'post_type'      => $post_type,
        'posts_per_page' => 1,
        'no_found_rows'  => true,
        'post__not_in'   => array( $post_id ),
        'tax_query'      => array(
            array(
                


    foreach ( $cronhooks as $hook => $keys ) {

        foreach ( $keys as $k => $v ) {

            $schedule = $v['schedule'];

            if ( $schedule ) {
                $result = wp_reschedule_event( $timestamp$schedule$hook$v['args'], true );

                if ( is_wp_error( $result ) ) {
                    error_log(
                        sprintf(
                            /* translators: 1: Hook name, 2: Error code, 3: Error message, 4: Event data. */
                            __( 'Cron reschedule event error for hook: %1$s, Error code: %2$s, Error message: %3$s, Data: %4$s' ),
                            $hook,
                            $result->get_error_code(),
                            $result->get_error_message(),
                            wp_json_encode( $v )
                        )
                    );

                    
$post_id = absint( $_REQUEST['post_id'] );
    if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
        $post_id = 0;
    }
}

if ( $_POST ) {
    if ( isset( $_POST['html-upload'] ) && ! empty( $_FILES ) ) {
        check_admin_referer( 'media-form' );
        // Upload File button was clicked.         $upload_id = media_handle_upload( 'async-upload', $post_id );
        if ( is_wp_error( $upload_id ) ) {
            wp_die( $upload_id );
        }
    }
    wp_redirect( admin_url( 'upload.php' ) );
    exit;
}

// Used in the HTML title tag. $title       = __( 'Upload New Media' );
$parent_file = 'upload.php';

/** * Checks if a given request has access to read a user. * * @since 4.7.0 * * @param WP_REST_Request $request Full details about the request. * @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object. */
    public function get_item_permissions_check( $request ) {
        $user = $this->get_user( $request['id'] );
        if ( is_wp_error( $user ) ) {
            return $user;
        }

        $types = get_post_types( array( 'show_in_rest' => true ), 'names' );

        if ( get_current_user_id() === $user->ID ) {
            return true;
        }

        if ( 'edit' === $request['context'] && ! current_user_can( 'list_users' ) ) {
            return new WP_Error(
                
/** * Retrieves a collection of search results. * * @since 5.0.0 * * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */
    public function get_items( $request ) {
        $handler = $this->get_search_handler( $request );
        if ( is_wp_error( $handler ) ) {
            return $handler;
        }

        $result = $handler->search_items( $request );

        if ( ! isset( $result[ WP_REST_Search_Handler::RESULT_IDS ] ) || ! is_array( $result[ WP_REST_Search_Handler::RESULT_IDS ] ) || ! isset( $result[ WP_REST_Search_Handler::RESULT_TOTAL ] ) ) {
            return new WP_Error(
                'rest_search_handler_error',
                __( 'Internal search handler error.' ),
                array( 'status' => 500 )
            );
        }
$attachment_id,
                0,
                0,
                $width,
                $height,
                $max_width,
                $height / $oitar,
                false,
                str_replace( wp_basename( $file ), 'midsize-' . wp_basename( $file )$file )
            );

            if ( ! $image || is_wp_error( $image ) ) {
                wp_die( __( 'Image could not be processed. Please go back and try again.' )__( 'Image Processing Error' ) );
            }

            /** This filter is documented in wp-admin/includes/class-custom-image-header.php */
            $image = apply_filters( 'wp_create_file_in_uploads', $image$attachment_id ); // For replication.
            $url    = str_replace( wp_basename( $url )wp_basename( $image )$url );
            $width  = $width / $oitar;
            $height = $height / $oitar;
        } else {
            $oitar = 1;
        }
Home | Imprint | This part of the site doesn't use cookies.