[As community content, this post reflects the views and opinions of the particular author and does not necessarily reflect the official stance of Neo4j. This article was originally posted by Tim Nash and was used with permission.]
Ever wondered how to make WordPress even more powerful when it comes to custom post types? Ever struggled to query how different custom post types were related to one another? In this week’s community post, Tim Nash shows you how to use Neo4j to give WordPress relationship advice. So, how do you get Neo4j working with WordPress? Neo4j has a REST API interface, along with a couple of dedicated PHP libraries. Several Javascript libraries also exist, which might be more appropriate depending on circumstances. When initially choosing a PHP library I chose Neoxygen Neoclient. However this is not essential and calls can be made with WP_HTTP API. So this is the point where you are expecting a nice link to Github with a lovely wrapper, that creates nodes and relationships directly on saves and provides a WPDB-like interface for interacting with Cypher right? Sorry to disappoint. It’s not quite that simple. As we have already mentioned, WordPress has no concept of relationships between posts, all of that has to be built first. Then you have to decide what content to push. You could push all metadata and all Posts into Neo4j along with users and taxonomies or just a small subset. I tend to choose to push just the information I need to effectively query and build queries from and then grab post objects, based on returned IDs from Neo4j. Read the full article here Interested in doing more with Neo4j? Click below to download a free copy of Learning Neo4j the comprehensive ebook that walks you through the radical new way of dealing with connected data. Download My Free Ebook