Changeset 10802
- Timestamp:
- 03/10/2021 05:34:15 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r10801 r10802 1683 1683 */ 1684 1684 public static function get_plugin_post( $plugin_slug = null ) { 1685 global $post;1686 1687 1685 if ( $plugin_slug instanceof \WP_Post ) { 1688 1686 return $plugin_slug; … … 1692 1690 if ( 1693 1691 is_int( $plugin_slug ) && 1694 ( $post _obj= get_post( $plugin_slug ) ) &&1695 ( $post _obj->ID === $plugin_slug )1692 ( $post = get_post( $plugin_slug ) ) && 1693 ( $post->ID === $plugin_slug ) 1696 1694 ) { 1697 $post = $post_obj; 1698 return $post_obj; 1695 return $post; 1699 1696 } 1700 1697 1701 1698 // Use the global $post object when appropriate 1702 if ( ! empty( $post ) && 'plugin' == $post->post_type ) { 1699 if ( 1700 ! empty( $GLOBALS['post']->post_type ) && 1701 'plugin' === $GLOBALS['post']->post_type 1702 ) { 1703 1703 // Default to the global object. 1704 1704 if ( is_null( $plugin_slug ) || 0 === $plugin_slug ) { 1705 return get_post( $ post->ID );1705 return get_post( $->ID ); 1706 1706 } 1707 1707 1708 1708 // Avoid hitting the database if it matches. 1709 if ( $plugin_slug == $ post->post_name ) {1710 return get_post( $ post->ID );1709 if ( $plugin_slug == $->post_name ) { 1710 return get_post( $->ID ); 1711 1711 } 1712 1712 }
Note: See TracChangeset
for help on using the changeset viewer.