Changeset 16947 for trunk/wp-includes/query.php
- Timestamp:
- 12/15/2010 12:21:27 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r16894 r16947 143 143 global $wp_query; 144 144 145 if ( ! isset( $wp_query ) ) { 146 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 147 // return false; 148 } 149 145 150 return $wp_query->is_archive(); 146 151 } … … 159 164 global $wp_query; 160 165 166 if ( ! isset( $wp_query ) ) { 167 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 168 // return false; 169 } 170 161 171 return $wp_query->is_post_type_archive( $post_types ); 162 172 } … … 174 184 global $wp_query; 175 185 186 if ( ! isset( $wp_query ) ) { 187 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 188 // return false; 189 } 190 176 191 return $wp_query->is_attachment(); 177 192 } … … 193 208 global $wp_query; 194 209 210 if ( ! isset( $wp_query ) ) { 211 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 212 // return false; 213 } 214 195 215 return $wp_query->is_author( $author ); 196 216 } … … 212 232 global $wp_query; 213 233 234 if ( ! isset( $wp_query ) ) { 235 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 236 // return false; 237 } 238 214 239 return $wp_query->is_category( $category ); 215 240 } … … 230 255 function is_tag( $slug = '' ) { 231 256 global $wp_query; 257 258 if ( ! isset( $wp_query ) ) { 259 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 260 // return false; 261 } 232 262 233 263 return $wp_query->is_tag( $slug ); … … 253 283 */ 254 284 function is_tax( $taxonomy = '', $term = '' ) { 255 global $wp_query, $wp_taxonomies; 285 global $wp_query; 286 287 if ( ! isset( $wp_query ) ) { 288 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 289 // return false; 290 } 256 291 257 292 return $wp_query->is_tax( $taxonomy, $term ); … … 270 305 global $wp_query; 271 306 307 if ( ! isset( $wp_query ) ) { 308 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 309 // return false; 310 } 311 272 312 return $wp_query->is_comments_popup(); 273 313 } … … 285 325 global $wp_query; 286 326 327 if ( ! isset( $wp_query ) ) { 328 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 329 // return false; 330 } 331 287 332 return $wp_query->is_date(); 288 333 } … … 300 345 global $wp_query; 301 346 347 if ( ! isset( $wp_query ) ) { 348 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 349 // return false; 350 } 351 302 352 return $wp_query->is_day(); 303 353 } … … 316 366 global $wp_query; 317 367 368 if ( ! isset( $wp_query ) ) { 369 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 370 // return false; 371 } 372 318 373 return $wp_query->is_feed( $feeds ); 319 374 } … … 330 385 function is_comment_feed() { 331 386 global $wp_query; 387 388 if ( ! isset( $wp_query ) ) { 389 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 390 // return false; 391 } 332 392 333 393 return $wp_query->is_comment_feed(); … … 356 416 global $wp_query; 357 417 418 if ( ! isset( $wp_query ) ) { 419 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 420 // return false; 421 } 422 358 423 return $wp_query->is_front_page(); 359 424 } … … 380 445 global $wp_query; 381 446 447 if ( ! isset( $wp_query ) ) { 448 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 449 // return false; 450 } 451 382 452 return $wp_query->is_home(); 383 453 } … … 395 465 global $wp_query; 396 466 467 if ( ! isset( $wp_query ) ) { 468 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 469 // return false; 470 } 471 397 472 return $wp_query->is_month(); 398 473 } … … 417 492 global $wp_query; 418 493 494 if ( ! isset( $wp_query ) ) { 495 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 496 // return false; 497 } 498 419 499 return $wp_query->is_page( $page ); 420 500 } … … 432 512 global $wp_query; 433 513 514 if ( ! isset( $wp_query ) ) { 515 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 516 // return false; 517 } 518 434 519 return $wp_query->is_paged(); 435 520 } … … 447 532 global $wp_query; 448 533 534 if ( ! isset( $wp_query ) ) { 535 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 536 // return false; 537 } 538 449 539 return $wp_query->is_preview(); 450 540 } … … 462 552 global $wp_query; 463 553 554 if ( ! isset( $wp_query ) ) { 555 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 556 // return false; 557 } 558 464 559 return $wp_query->is_robots(); 465 560 } … … 477 572 global $wp_query; 478 573 574 if ( ! isset( $wp_query ) ) { 575 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 576 // return false; 577 } 578 479 579 return $wp_query->is_search(); 480 580 } … … 501 601 global $wp_query; 502 602 603 if ( ! isset( $wp_query ) ) { 604 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 605 // return false; 606 } 607 503 608 return $wp_query->is_single( $post ); 504 609 } … … 523 628 global $wp_query; 524 629 630 if ( ! isset( $wp_query ) ) { 631 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 632 // return false; 633 } 634 525 635 return $wp_query->is_singular( $post_types ); 526 636 } … … 538 648 global $wp_query; 539 649 650 if ( ! isset( $wp_query ) ) { 651 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 652 // return false; 653 } 654 540 655 return $wp_query->is_time(); 541 656 } … … 553 668 global $wp_query; 554 669 670 if ( ! isset( $wp_query ) ) { 671 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 672 // return false; 673 } 674 555 675 return $wp_query->is_trackback(); 556 676 } … … 568 688 global $wp_query; 569 689 690 if ( ! isset( $wp_query ) ) { 691 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 692 // return false; 693 } 694 570 695 return $wp_query->is_year(); 571 696 } … … 582 707 function is_404() { 583 708 global $wp_query; 709 710 if ( ! isset( $wp_query ) ) { 711 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the init hook. They always return false.' ), '3.1' ); 712 // return false; 713 } 584 714 585 715 return $wp_query->is_404();
Note: See TracChangeset
for help on using the changeset viewer.