Sometimes it is useful to display all methods name given a reference to object. This can be used to debug and understand wordpress or any other existing code. Here is code snippet for wordpress $query object.
$class = get_class ($query); error_log("=====class=$class"); $methods = get_class_methods($class); error_log("=====methods=" . print_r($methods, True));
Now visit any web page which will cause above code to execute and look for log entries in php error log in /var/log/php_errors.log
. The log location may be different on your system. Here is the outcome for above code inside a wordpress code:
[16-Nov-2015 07:35:09 UTC] =====class=WP_Query [16-Nov-2015 07:35:09 UTC] =====methods=Array ( [0] => init [1] => parse_query_vars [2] => fill_query_vars [3] => parse_query [4] => parse_tax_query [5] => set_404 [6] => get [7] => set [8] => get_posts [9] => next_post [10] => the_post [11] => have_posts [12] => rewind_posts [13] => next_comment [14] => the_comment [15] => have_comments [16] => rewind_comments [17] => query [18] => get_queried_object [19] => get_queried_object_id [20] => __construct [21] => __get [22] => __isset [23] => __call [24] => is_archive [25] => is_post_type_archive [26] => is_attachment [27] => is_author [28] => is_category [29] => is_tag [30] => is_tax [31] => is_comments_popup [32] => is_date [33] => is_day [34] => is_feed [35] => is_comment_feed [36] => is_front_page [37] => is_home [38] => is_month [39] => is_page [40] => is_paged [41] => is_preview [42] => is_robots [43] => is_search [44] => is_single [45] => is_singular [46] => is_time [47] => is_trackback [48] => is_year [49] => is_404 [50] => is_main_query [51] => setup_postdata [52] => reset_postdata )