Use the following helper functions to access save data from the
xfwp option key, and even get postmeta values from any post with an attached XF thread.
Access XFtoWP option
For your convenience you can also access the curated forum data XFtoWP saves to your database each time you refresh the forum data in WP admin > XenForo > Refresh forum data. Simply call the following function:
This accesses the
xfwp option created in your site database. You can also make calls to specific data by traversing the returned array like so:
xf_option( array( 'data', 'get_forums' ) );
The above function gets an array of the known forums you’ve added in WP admin > XenForo > Site connection > Forums.
Again, data called from this function is pre-cached (optimally saved to your database) so there is no performance hit to your site to access this data about your forum!
Get post meta
Finally, you can also access data saved to each post (when creating/connecting a thread) by accessing the
xfwp post meta key. This holds the list of posts and other thread info per post:
Traverse the postmeta data in the same way. Here’s how you get a list of the first page of posts saved to your post meta:
xf_post_meta( array( 'posts' ) );