So, I've run into what looks like a WP RAM usage problem and am looking for a solution.
The only place I'm really having this problem on my site is with a Site Map page that I'm trying to populate, but a solution to this problem could be universally applied and save on RAM usage across an entire site.
Essentially, this Site Map page I have is a list of all
pages on my site. The only elements of the $post variable that I need access to on this page are the title and permalink. Unfortunately, the query I'm using returns all posts with all the information in each of their $post variables.
The following is an example of a query I'm using on this Site Map page for a single
custom-post-type named "products" with a custom taxonomy of "supplements" and term "all-supplements". My Site Map page has multiple such queries, but for explanatory purposes I'm only including the code for this single query.
$varArray= array( 'post_type' => 'products', 'post_status' => 'publish', 'supplements' => 'all-supplements', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC' ); $myProducts= new WP_Query($varArray);
The large majority of the information saved within the $post variable (for my site, and I'm guessing that this trend is seen for general usage) is found within "the content" The typical RAM usage for my Site Map page is ~140MB (reported by Debug Bar), whereas the usage for any other typical page on my site is 50-60MB. Big difference. Yesterday the Site Map page stopped working (WSOD), and to fix it I had to increase the maximum amount of RAM that WP can use. So I'm increasing overall necessary system resources because of a single page.
Thus, I come to my question.
Is there a pathway/option somewhere within Wordpress that I'm missing that would fetch
pages like a normal query, but NOT get the content for retrieved posts?
Or, alternatively, is there some easier way for me to only grab particular elements within a given query (Title/Permaklink/Slug/etc...) instead of getting the whole $post variable shebang?
It seems to me that for many WP applications, the only place that "the content" of a post/page would typically be needed is on that
post page (obviously there are exceptions here), and that having access to the full content for posts/pages retrieved by query on other pages is simple overkill. If there is a way of avoiding loading up the full content for post list pages, then a significant amount of RAM usage could be saved.
Any help would be appreciated.