Making WordPress.org

Changeset 5148


Ignore:
Timestamp:
03/13/2017 04:00:59 PM (8 years ago)
Author:
danielbachhuber
Message:

make/cli: Prevent GitHub edit links from appearing in nav

The handbook plugin uses get_the_title() to prepare nav links,
which means we can compare the supplied $id to get_queried_object_id()

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-cli
Files:
2 edited

Legend:

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

    r4802 r5148  
    88     * Append a "Edit on GitHub" link to Handbook document titles
    99     */
    10     public static function filter_the_title_edit_link( $title ) {
     10    public static function filter_the_title_edit_link( $title, $id = null ) {
    1111        // Only apply to the main title for the document
    1212        if ( ! is_singular( 'handbook' )
    1313            || ! is_main_query()
    1414            || ! in_the_loop()
    15             || get_the_ID() !== get_queried_object_id() ) {
     15            || $id !== get_queried_object_id() ) {
    1616            return $title;
    1717        }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-cli/wporg-cli.php

    r4786 r5148  
    2121add_action( 'save_post', array( 'WPOrg_Cli\Markdown_Import', 'action_save_post' ) );
    2222add_filter( 'cron_schedules', array( 'WPOrg_Cli\Markdown_Import', 'filter_cron_schedules' ) );
    23 add_filter( 'the_title', array( 'WPOrg_Cli\Handbook', 'filter_the_title_edit_link' ) );
     23add_filter( 'the_title', array( 'WPOrg_Cli\Handbook', 'filter_the_title_edit_link' ), 10, 2 );
    2424add_filter( 'get_edit_post_link', array( 'WPOrg_Cli\Handbook', 'redirect_edit_link_to_github' ), 10, 3 );
    2525add_filter( 'o2_filter_post_actions', array( 'WPOrg_Cli\Handbook', 'redirect_o2_edit_link_to_github' ), 11, 2 );
Note: See TracChangeset for help on using the changeset viewer.