InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Wordpress How-Tos

  • angularjs in wordpress
  • Convert wordpress page to posts and vice versa
  • Find all user created wordpress custom field keys
  • How to automate wordpress sandbox setup on Linux
  • How to capture php code or included file output in a variable
  • How to check the performance of a plugin using mysql query log
  • How to migrate wordpress from root to sub directory
  • How to upgrade wordpress manually
  • How to view wordpress current version
  • Setup xdebug for remote wordpress debugging
  • Wordpress - disable theme and plugin editing
  • Wordpress - get wpdb class method names
  • Wordpress multisite network vs normal installation
  • display method names from php WP_Query object
  • find if a wordpress page is leaf page
 
  • Home
  • > Tutorials
  • > Wordpress
  • > Wordpress How To

display method names from php WP_Query object

By admin on Nov 16, 2015

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
)

Suggested posts:

  1. React – list of all factory methods of React.DOM
  2. WordPress – how to add filter to description meta tag
  3. How to add tag and category to wordpress pages
  4. PHP – get class name and file name from an object
  5. Phantomjs – how to check what resources are being requested by a page
  6. find if a wordpress page is leaf page
  7. Javascript check if variable is defined
  8. CSS3 cursors – change cursor on an element
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Tutorials, Wordpress, Wordpress How To
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress