Ticket #1749 (closed defect (bug): invalid)
Global Variables are not available in Plugin functions
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | highest omg bbq | Milestone: | |
| Component: | General | Version: | 1.6 |
| Severity: | critical | Keywords: | Plugin , Global Variables bg|squashed |
| Cc: |
Description
I've just tested out some plugins on Wordpress 1.6 that used to work in ver 1.5 , After an hour of debugging I found out that global variables are not available in plugin functions , for example
function mps_jalali_query($where) {
global $m,$hour,$minute,$second,$year,$monthnum,$day;
...
...
}
...
add_filter("posts_where","mps_jalali_query");
but $m, $hour, $minute , etc are not available in the function , they are NULL in the function !
Change History
comment:1
markjaquith — 6 years ago
comment:2
markjaquith — 6 years ago
- Keywords bg|squashed added
- Status changed from new to closed
- Resolution set to invalid
Note: See
TracTickets for help on using
tickets.

try setting global $wp_query; and using $wp_query->query_varshour?, $wp_query->query_varsday?, etc...