Making WordPress.org


Ignore:
Timestamp:
03/04/2021 11:02:08 PM (4 years ago)
Author:
coffee2code
Message:

Handbooks, Handbook: Check for array elements before using their value, to prevent PHP notices.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/handbook.php

    r10752 r10755  
    270270
    271271        // Override the presumed label with a potentially customized value.
    272         $this->label = $config['labels']['name'];
     272        if ( ! empty( $config['labels']['name'] ) ) {
     273            $this->label = $config['labels']['name'];
     274        }
    273275
    274276        register_post_type( $this->post_type, $config );
     
    516518     */
    517519    public function o2_post_fragment( $post_fragment ) {
     520        if ( empty( $post_fragment['id'] ) ) {
     521            return $post_fragment;
     522        }
     523
    518524        $post = get_post( $post_fragment['id'] );
    519525        if ( ! $post ) {
Note: See TracChangeset for help on using the changeset viewer.