Changeset 34903 for trunk/src/wp-includes/query.php
- Timestamp:
- 10/07/2015 10:35:18 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r34836 r34903 717 717 718 718 return $wp_query->is_404(); 719 } 720 721 /** 722 * Is the query for an embedded post? 723 * 724 * @since 4.4.0 725 * 726 * @global WP_Query $wp_query Global WP_Query instance. 727 * 728 * @return bool Whether we're in an embedded post or not. 729 */ 730 function is_embed() { 731 global $wp_query; 732 733 if ( ! isset( $wp_query ) ) { 734 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); 735 return false; 736 } 737 738 return $wp_query->is_embed(); 719 739 } 720 740 … … 1200 1220 */ 1201 1221 public $is_404 = false; 1222 1223 /** 1224 * Set if query is embed. 1225 * 1226 * @since 4.4.0 1227 * @access public 1228 * @var bool 1229 */ 1230 public $is_embed = false; 1202 1231 1203 1232 /** … … 1846 1875 $this->set_404(); 1847 1876 1877 $this->is_embed = isset( $qv['embed'] ) && ( $this->is_singular || $this->is_404 ); 1878 1848 1879 $this->query_vars_hash = md5( serialize( $this->query_vars ) ); 1849 1880 $this->query_vars_changed = false; … … 4636 4667 4637 4668 /** 4669 * Is the query for an embedded post? 4670 * 4671 * @since 3.1.0 4672 * 4673 * @return bool 4674 */ 4675 public function is_embed() { 4676 return (bool) $this->is_embed; 4677 } 4678 4679 /** 4638 4680 * Is the query the main query? 4639 4681 * … … 4936 4978 } elseif ( isset( $GLOBALS['wp_query']->query_vars['paged'] ) && $GLOBALS['wp_query']->query_vars['paged'] > 1 ) { 4937 4979 $link = user_trailingslashit( trailingslashit( $link ) . 'page/' . $GLOBALS['wp_query']->query_vars['paged'] ); 4980 } elseif( is_embed() ) { 4981 $link = user_trailingslashit( trailingslashit( $link ) . 'embed' ); 4938 4982 } elseif ( is_404() ) { 4939 4983 // Add rewrite endpoints if necessary.
Note: See TracChangeset
for help on using the changeset viewer.