Is there a way to exclude the content from the post variable to save on RAM usage?

You can try a trick with querying post data directly and setting filter field of post objects to sample before passing it to get_permalink() to reduce memory usage.

See get_permalink memory usage issue for detailed reasoning behind it.

Leave a Comment