question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using Intertia.js with WordPress server-side

See original GitHub issue

Has anybody tried, or is it against nature? šŸ˜…

I am thinking of a WordPress theme where the PHP templates fetch their data from the DB using standard WordPress API (get_post, WP_Query…) and then call Inertia::render().

I guess it would be faster than using WordPress REST APIs from the client…

Thank you! Guido

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

17reactions
boxybirdcommented, May 12, 2020

@coccoinomane Your thoughts on using get_posts() with Inertia::render() are right on the money. It’s 100% possible. I built a WordPress plugin that does just that, and more: https://github.com/boxybird/wordpress-inertia-plugin

A little demo using the plugin: https://github.com/boxybird/wordpress-inertia-demo-theme

@lkraav I agree

It’d probably be prudent to discuss JS-rendering SEO implications in another forum, since at minimum, SEO is not even required for some (intranet) apps. Let’s keep this issue for the actual integration implementation concern.

Plus, the SEO discussion wouldn’t be WordPress specific. The same challenges exists when using Inertia with Laravel and Rails.

4reactions
lkraavcommented, Mar 4, 2020

So yeah, I tend to agree with some of the comments here that suggest using Inertia with WordPress (should it even be possible) isn’t probably a great idea, because of the lack of server-side rendering.

ā“ I’m not sure what ā€œlack of server-side renderingā€ means here. As far as I can tell, WP is nothing but a server-side rendered app 😃

Can we keep this issue open for a while longer, so more interested parties could find it better? I still have a hunch there’s a way to make it work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server-side rendering (SSR) - Inertia.js
Server -side rendering allows you to pre-render an initial page visit on the server, and to send the rendered HTML to the browser....
Read more >
The Ultimate Guide to Inertia.js - Kinsta
Creating an SPA using Inertia is similar to creating a server-side rendered app. You create controllers, make queries to the database forĀ ...
Read more >
Server side rendering with Laravel + Inertia.js + Vue.js
Next we need to create a server configuration file called ssr.js inside the same folder as our app.js , meaning resources/js . This...
Read more >
Inertia.js: Building Single-Page Apps the Old Way
Inertia converts your initial server-rendered HTML page into a SPA by passing a page object into a client-side app. This page object includesĀ ......
Read more >
Laravel Inertia: Installation Tutorial and Tips & Tricks
Inertia is a JavaScript-based routing library popularly used for developing modern Single Page Apps by leveraging classic server-side routingĀ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found