I am working on a wordpress that someone else started and then disappeared. She created a few of custom content types and variables using different plugins and I now want to access the data sets in the functions she created for her template.
$ args = array( 'suppress_filters' => 0, 'posts_per_page' => -1, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'post_type' => 'inst', 'post_status' => 'publish' ); $ content = get_posts($ args);
I have been looking around and different findings suggested using the following variable to get the SQL used:
echo $ GLOBALS['wp_query']->request;
However what this returns is not the query that shows the post data appearing on the page. When I run that in MySQL directly, it returns exactly 1 result and I think it’s the whole page? Because I defined two datasets and there are two fields appearing on the page but only 1 row in the query that’s echoed by above line.
I need to know the exact attributes of the WP_Query object in $ content but var_dump($ content) also doesn’t contain the fields I defined. I need to get the image that’s in the content type set, but I can only get the name of the set accessing $ content->post_title.
Is there a way to dig into what get_posts() gets from the database and how I can access the attributes I need?