Making WordPress.org


Ignore:
Timestamp:
03/05/2021 12:50:03 AM (3 years ago)
Author:
coffee2code
Message:

Handbooks, Explicitly remove '-handbook' from post types rather than assuming it's the last nine characters.

File:
1 edited

Legend:

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

    r10780 r10781  
    135135            // If no name defined yet, try handbook post type if not standard.
    136136            if ( ! $name && ( 'handbook' !== $post_type ) ) {
    137                 $name = ucfirst( substr( $post_type, 0, -9 ) );
     137                $name = ucfirst( str_replace( '-handbook', '', $post_type ) );
    138138            }
    139139
     
    285285        $label = ( 'handbook' === $this->post_type ) ?
    286286            __( 'Handbook name', 'wporg' ) :
    287             sprintf( __( 'Handbook name (%s)', 'wporg' ), substr( $this->post_type, 0, -9 ) );
     287            sprintf( __( 'Handbook name (%s)', 'wporg' ), str_replace( '-handbook', '', $this->post_type ) );
    288288
    289289        add_settings_field(
     
    525525            $page = get_page_by_path( $this->post_type, OBJECT, $this->post_type );
    526526            if ( ! $page ) {
    527                 $slug = substr( $this->post_type, 0, -9 );
     527                $slug = str_replace( '-handbook', '', $this->post_type );
    528528                $page = get_page_by_path( $slug, OBJECT, $this->post_type );
    529529            }
Note: See TracChangeset for help on using the changeset viewer.