<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fh="http://purl.org/syndication/history/1.0"><channel><title>Loopress | Blog</title><description/><link>https://docs.loopress.dev/</link><language>en</language><fh:complete/><atom:link rel="self" href="https://docs.loopress.dev/blog/rss.xml"/><item><title>When a WordPress REST Route Shouldn&apos;t Return JSON</title><link>https://docs.loopress.dev/blog/wordpress-rest-api-route-without-json/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/wordpress-rest-api-route-without-json/</guid><description>The WordPress REST API speaks JSON, so every route ends up returning JSON, even when the thing calling it is a calendar app, a spreadsheet download, or an AI crawler. Pick the response shape from the caller instead.</description><pubDate>Sun, 25 Oct 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;It started with a student on my sister’s tutoring site asking for the blog posts as PDFs. A route that renders a post to PDF is a few lines with Dompdf. Then I started imagining the next ones: an Excel export of orders, a QR code for an event ticket, a calendar feed, a Markdown version of a post for an AI crawler. None of them wanted to answer in JSON.&lt;/p&gt;
&lt;p&gt;The WordPress REST API is built around JSON. Return an array from a callback, WordPress serializes it, sets &lt;code dir=&quot;auto&quot;&gt;Content-Type: application/json&lt;/code&gt;, done. It’s such a good default that it becomes the only answer, and then you find yourself base64-encoding a PDF into a JSON field so a browser can… decode it back into a PDF.&lt;/p&gt;
&lt;p&gt;The question that decides the response shape isn’t “what does the route produce”. It’s &lt;strong&gt;who calls it, and what do they do with the answer&lt;/strong&gt;. Across the &lt;a href=&quot;https://docs.loopress.dev/cookbook/&quot;&gt;cookbook&lt;/a&gt; recipes I’ve built with &lt;a href=&quot;https://docs.loopress.dev/api/routes/&quot;&gt;custom API routes&lt;/a&gt;, four shapes cover everything.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;shape-1-json-for-code-that-reads-fields&quot;&gt;Shape 1: JSON, for code that reads fields&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A frontend &lt;code dir=&quot;auto&quot;&gt;fetch()&lt;/code&gt;, a mobile app, a CI script: the caller parses the response and picks fields out of it. That’s what JSON is for, and what a route gives you by returning an array or a &lt;code dir=&quot;auto&quot;&gt;WP_REST_Response&lt;/code&gt;:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;WP_REST_Request&lt;/span&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&lt;span&gt;$request&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;array&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;id&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;482&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;status&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;valid&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;];&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Nothing to decide here. It’s the default because it’s the right answer most of the time.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;shape-2-a-file-inside-json-as-a-data-uri&quot;&gt;Shape 2: a file inside JSON, as a data URI&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Sometimes the caller is still code, but what it wants is a small image to drop into the page: a resized thumbnail, a ticket’s QR code. The route can put the image in a JSON field as a &lt;code dir=&quot;auto&quot;&gt;data:&lt;/code&gt; URI:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;WP_REST_Response&lt;/span&gt;&lt;span&gt;([&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;data_uri&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;data:image/png;base64,&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;base64_encode&lt;/span&gt;&lt;/span&gt;&lt;span&gt;($&lt;/span&gt;&lt;span&gt;result&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;getString&lt;/span&gt;&lt;span&gt;()),&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;]);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The frontend sets it straight as &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;img src&gt;&lt;/code&gt;, no second request, and the JSON envelope can carry other fields next to it (dimensions, an expiry). I use this for &lt;a href=&quot;https://docs.loopress.dev/cookbook/documents-and-files/qr-code-generation-wordpress-rest-api/&quot;&gt;ticket QR codes&lt;/a&gt; and on-the-fly image resizing.&lt;/p&gt;
&lt;p&gt;The limits are real, so keep it for small files. Base64 makes the payload a third bigger than the raw bytes. The browser can’t cache the image on its own, only the whole JSON response. And a human can’t open the URL and see the image, they see a wall of base64. My QR code is a 519-byte PNG, 737 bytes as JSON: fine. A 2 MB photo as JSON is not.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;shape-3-raw-bytes-with-your-own-headers&quot;&gt;Shape 3: raw bytes, with your own headers&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;When the caller isn’t your code at all, JSON is simply wrong:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A browser navigating to the URL&lt;/strong&gt;, from a “Download as PDF” link: it needs &lt;code dir=&quot;auto&quot;&gt;Content-Type: application/pdf&lt;/code&gt; and a &lt;code dir=&quot;auto&quot;&gt;Content-Disposition&lt;/code&gt; header, or it shows gibberish.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A calendar app subscribed to a feed&lt;/strong&gt;: it expects &lt;code dir=&quot;auto&quot;&gt;text/calendar&lt;/code&gt;, and never sends anything WordPress could negotiate on.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code dir=&quot;auto&quot;&gt;curl -o report.xlsx&lt;/code&gt;&lt;/strong&gt; in someone’s cron job: it writes whatever bytes arrive to disk.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;An AI crawler or an &lt;code dir=&quot;auto&quot;&gt;llms.txt&lt;/code&gt; consumer&lt;/strong&gt;: it wants &lt;code dir=&quot;auto&quot;&gt;text/markdown&lt;/code&gt;, not HTML in a JSON string.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A route verb method doesn’t have to return anything. It can send its own headers, echo the body, and stop:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;// ... build $xlsxBytes&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;header&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;header&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;Content-Disposition: attachment; filename=&quot;orders.xlsx&quot;&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;echo&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$xlsxBytes&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;exit&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;That’s the whole trick, documented as &lt;a href=&quot;https://docs.loopress.dev/api/routes/#streaming-a-file-instead-of-json&quot;&gt;streaming a file instead of JSON&lt;/a&gt;. The &lt;a href=&quot;https://docs.loopress.dev/cookbook/documents-and-files/post-to-pdf-dompdf-wordpress-rest-api/&quot;&gt;post to PDF&lt;/a&gt; recipe, the one the student asked for, works this way, and so does &lt;a href=&quot;https://docs.loopress.dev/cookbook/documents-and-files/spreadsheet-export-phpspreadsheet-wordpress-rest-api/&quot;&gt;WooCommerce orders to Excel&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;shape-4-a-redirect-when-the-file-already-exists&quot;&gt;Shape 4: a redirect, when the file already exists&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;That 2 MB photo, or a PDF already sitting in the media library, doesn’t need to travel through PHP at all. The route decides &lt;em&gt;which&lt;/em&gt; file the caller gets, checks they’re allowed to have it, and points them at it:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;WP_REST_Request&lt;/span&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&lt;span&gt;$request&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;WP_REST_Response&lt;/span&gt;&lt;span&gt;|&lt;/span&gt;&lt;span&gt;WP_Error&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;$url&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;wp_get_attachment_url&lt;/span&gt;&lt;span&gt;((&lt;/span&gt;&lt;span&gt;int&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;request&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;get_param&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;attachment_id&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;));&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;$url&lt;/span&gt;&lt;span&gt;) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;WP_Error&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;not_found&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;No such file.&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;status&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;404&lt;/span&gt;&lt;span&gt;]);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;WP_REST_Response&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;302&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;Location&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;url&lt;/span&gt;&lt;span&gt;]);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The web server sends the bytes, with its own caching and range requests, and the route stays a normal REST response: no &lt;code dir=&quot;auto&quot;&gt;exit&lt;/code&gt;, nothing skipped. Keep the &lt;code dir=&quot;auto&quot;&gt;WP_Error&lt;/code&gt;: without it, an unknown id answers a 302 with an empty &lt;code dir=&quot;auto&quot;&gt;Location&lt;/code&gt;, which I only caught by calling the route on a real site.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-to-know-before-shipping-one&quot;&gt;What to know before shipping one&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Checked on a real site, and in how Loopress loads route files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Errors can still be JSON.&lt;/strong&gt; Return a &lt;code dir=&quot;auto&quot;&gt;WP_Error&lt;/code&gt; &lt;em&gt;before&lt;/em&gt; the headers go out and WordPress answers it like any other REST error, &lt;code dir=&quot;auto&quot;&gt;{&quot;code&quot;:&quot;not_found&quot;,...,&quot;data&quot;:{&quot;status&quot;:404}}&lt;/code&gt;. Only the success path is raw. A caller that gets a 404 shouldn’t have to parse a PDF to find out.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A throw is a JSON 500, not a fatal.&lt;/strong&gt; An uncaught exception in a verb method, raised before your headers go out, comes back as &lt;code dir=&quot;auto&quot;&gt;{&quot;error&quot;:&quot;Internal error&quot;}&lt;/code&gt; with a 500 status, and the rest of the site keeps working.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Permissions work the same.&lt;/strong&gt; &lt;code dir=&quot;auto&quot;&gt;permission()&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;#[Permission]&lt;/code&gt; are checked before the verb method ever runs, raw output or not. My Excel export is admin-only, the curl in its video authenticates with an Application Password like any other REST call.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;WordPress’s own REST headers are already there.&lt;/strong&gt; A raw response still carries &lt;code dir=&quot;auto&quot;&gt;Access-Control-Expose-Headers&lt;/code&gt; and the API &lt;code dir=&quot;auto&quot;&gt;Link&lt;/code&gt; header, WordPress sends those before your method runs. What &lt;code dir=&quot;auto&quot;&gt;exit&lt;/code&gt; skips is everything after it: the JSON serialization, and the &lt;code dir=&quot;auto&quot;&gt;rest_post_dispatch&lt;/code&gt; filters other plugins might hook.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A route-wide &lt;code dir=&quot;auto&quot;&gt;headers()&lt;/code&gt; method doesn’t run on a raw response.&lt;/strong&gt; Loopress applies &lt;a href=&quot;https://docs.loopress.dev/api/routes/#route-wide-headers-including-the-options-preflight&quot;&gt;&lt;code dir=&quot;auto&quot;&gt;headers()&lt;/code&gt;&lt;/a&gt; when WordPress serves the response, which is after your verb method returns. A method that calls &lt;code dir=&quot;auto&quot;&gt;exit&lt;/code&gt; never returns, so a CORS header declared there won’t be on the download. Send it with &lt;code dir=&quot;auto&quot;&gt;header()&lt;/code&gt; inside the verb method itself, next to &lt;code dir=&quot;auto&quot;&gt;Content-Type&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A raw route doesn’t belong in the discovery index.&lt;/strong&gt; &lt;code dir=&quot;auto&quot;&gt;/wp-json/{namespace}&lt;/code&gt; lists every route as a REST resource with its methods and args, which says nothing useful about an endpoint that answers with a PDF or a calendar feed. &lt;a href=&quot;https://docs.loopress.dev/api/routes/#hiding-a-route-from-the-discovery-index&quot;&gt;&lt;code dir=&quot;auto&quot;&gt;#[Hidden]&lt;/code&gt;&lt;/a&gt; on the class keeps the route out of that index, and it keeps dispatching exactly as before.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;h2 id=&quot;choosing-in-one-line-each&quot;&gt;Choosing, in one line each&lt;/h2&gt;&lt;/div&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;The caller&lt;/th&gt;
&lt;th&gt;The shape&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Your code, reading fields&lt;/td&gt;
&lt;td&gt;JSON&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Your code, showing a small image&lt;/td&gt;
&lt;td&gt;data URI in JSON&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A browser link, a download, &lt;code dir=&quot;auto&quot;&gt;curl -o&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;raw bytes + &lt;code dir=&quot;auto&quot;&gt;Content-Disposition&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A calendar app, a feed reader, a crawler&lt;/td&gt;
&lt;td&gt;raw bytes + the format’s own &lt;code dir=&quot;auto&quot;&gt;Content-Type&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Anyone, for a file that already exists&lt;/td&gt;
&lt;td&gt;a 302 to the file&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The mistake isn’t picking the wrong one of these. It’s never asking the question, and shipping JSON to a calendar app because that’s what the REST API does by default.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Try it on your own site: one PHP file in &lt;code dir=&quot;auto&quot;&gt;api/&lt;/code&gt;, one &lt;code dir=&quot;auto&quot;&gt;lps api push&lt;/code&gt;.&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;npm&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;install&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-g&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;@loopress/cli&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Custom API routes and Composer dependency management are &lt;a href=&quot;https://docs.loopress.dev/wordpress-plugin/&quot;&gt;Loopress Full&lt;/a&gt; features, free. &lt;a href=&quot;https://docs.loopress.dev/api/routes/&quot;&gt;Writing Route Files&lt;/a&gt; covers the rest: dynamic segments, verbs, permissions, CORS.&lt;/p&gt;
</content:encoded><category>rest api</category><category>wordpress</category><category>php</category></item><item><title>I Deleted 5,000 Lines of a Feature That Worked</title><link>https://docs.loopress.dev/blog/removing-a-feature/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/removing-a-feature/</guid><description>The SEO module worked, had tests, and was a headline feature of Loopress Light. Then, while documenting a newer feature, I reached for a Yoast setting as an example, and realized the old module mostly put content in Git.</description><pubDate>Sat, 24 Oct 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Loopress has one rule: it versions configuration, never content. Field groups, menus, post types, options, code. Not posts, not pages, not the things editors type into wp-admin every day.&lt;/p&gt;
&lt;p&gt;For months, one module broke that rule, and I didn’t notice, because it worked. I found out while writing the docs for a different feature, when the example I picked was a setting the old module was supposed to own.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-seo-module&quot;&gt;The SEO module&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;lps seo pull&lt;/code&gt; read everything Rank Math or Yoast stored and wrote it as JSON: the site-wide title templates, every post’s SEO meta, every redirect. &lt;code dir=&quot;auto&quot;&gt;lps seo push&lt;/code&gt; sent it back. It had a diff, a rollback, unit tests, an end-to-end suite running against both plugins, and a guard refusing to run when both plugins were active at once. It was in the first sentence of the Loopress Light listing on WordPress.org and on the homepage.&lt;/p&gt;
&lt;p&gt;Building it took a few days. The project’s structure was already set, and Claude Code did most of the typing. By every metric I usually look at, it was a finished feature.&lt;/p&gt;
&lt;p&gt;I just never really used it in production. And Loopress is young: as far as I know, nobody else did either.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-module-that-made-me-look&quot;&gt;The module that made me look&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The more time I spent in the WordPress ecosystem, the more I saw how much of WordPress core already fits Loopress’s rule, with no third-party plugin involved. Options came first: &lt;code dir=&quot;auto&quot;&gt;lps option add &amp;#x3C;name&gt;&lt;/code&gt; tracks a single &lt;code dir=&quot;auto&quot;&gt;wp_options&lt;/code&gt; row as a file in Git.&lt;/p&gt;
&lt;p&gt;Its docs needed a realistic example, and the first one that came to mind was &lt;code dir=&quot;auto&quot;&gt;wpseo_titles&lt;/code&gt;, Yoast’s settings row. That’s when it clicked. One of the SEO module’s jobs had just become a one-liner of another command. So I went to check what the rest of it was doing.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-it-actually-put-in-git&quot;&gt;What it actually put in Git&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;I opened the &lt;code dir=&quot;auto&quot;&gt;seo/&lt;/code&gt; folder of the site Loopress was born on, my sister’s French tutoring site, and read it file by file instead of trusting the green checkmarks.&lt;/p&gt;
&lt;p&gt;80 files of per-post meta. In all 80, a &lt;code dir=&quot;auto&quot;&gt;rank_math_internal_links_processed&lt;/code&gt; flag: an internal marker Rank Math sets for itself. In 72, a &lt;code dir=&quot;auto&quot;&gt;rank_math_seo_score&lt;/code&gt;: a number Rank Math computes. In 71, a &lt;code dir=&quot;auto&quot;&gt;rank_math_analytic_object_id&lt;/code&gt;: a row id in one database, which means nothing on another environment, and pushing it there quietly breaks the link. Robots directives stored as serialized PHP strings.&lt;/p&gt;
&lt;p&gt;What a human had actually written: 4 descriptions, 1 title, 9 focus keywords. And all of it belonged to a post, which makes it content, edited by whoever edits that post.&lt;/p&gt;
&lt;p&gt;27 redirect files, each carrying a hit counter and two timestamps, so every pull produced a diff nobody had caused, and every push could overwrite live counters on production. Targets were absolute production URLs. Every 410 became a file named after its database row id, &lt;code dir=&quot;auto&quot;&gt;N-redirect.json&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;And one &lt;code dir=&quot;auto&quot;&gt;settings.json&lt;/code&gt;: the title templates and schema defaults. Real configuration, finally. It was one row in &lt;code dir=&quot;auto&quot;&gt;wp_options&lt;/code&gt;, exactly what the &lt;a href=&quot;https://docs.loopress.dev/options/&quot;&gt;option module&lt;/a&gt; now tracks. So the only part of the SEO module that respected the rule was a duplicate of the newer command:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;option&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;add&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;rank-math-options-titles&lt;/span&gt;&lt;span&gt;   &lt;/span&gt;&lt;span&gt;# Rank Math&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;option&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;add&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;wpseo_titles&lt;/span&gt;&lt;span&gt;               &lt;/span&gt;&lt;span&gt;# Yoast SEO&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Everything else was content dressed up as configuration, plus the code needed to make that look safe: an adapter per SEO plugin, raw SQL against Rank Math’s redirect table, a check that redirect targets stay on the site, active-content stripping on every string. Each of those existed because the module was doing something Loopress shouldn’t do in the first place.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-removing-it-cost&quot;&gt;What removing it cost&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;It wasn’t free, and pretending otherwise would be dishonest.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A headline feature.&lt;/strong&gt; The WordPress.org listing, the homepage and the comparison pages all said “SEO”. Now they don’t.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Redirect versioning.&lt;/strong&gt; Some people will want it. It’s still content: redirects are created by editors in wp-admin, and they belong to the site, not the repository.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Anyone who did use it.&lt;/strong&gt; &lt;code dir=&quot;auto&quot;&gt;lps seo&lt;/code&gt; is gone since 0.30.0. Migrating is one command: track the option above, then delete &lt;code dir=&quot;auto&quot;&gt;seo/&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The removal itself was easy: &lt;a href=&quot;https://github.com/loopress/loopress/pull/307&quot;&gt;one pull request&lt;/a&gt;, 110 files touched, close to 5,000 lines deleted for 248 added. Not one folder, though. A headline feature spreads into the plugin, the CLI, the MCP server, the docs, the homepage and the end-to-end tests. Easy to remove is not the same as contained.&lt;/p&gt;
&lt;p&gt;What it gave back: a plugin that no longer reads or writes another plugin’s database tables, one less thing to explain on the homepage, and a rule that is true again, with no “except SEO” footnote.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-part-i-want-to-remember&quot;&gt;The part I want to remember&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Nothing was broken. No bug report, no failing test, no angry user, and no daily use of my own that could have shown me. A feature that is clearly wrong gets removed eventually. A feature that works, is tested, and doesn’t fit the product’s rule can stay forever, because it never gives you a reason to look at it.&lt;/p&gt;
&lt;p&gt;With an AI agent, building a feature like this takes days, not weeks. That makes the build the cheap part. The expensive part is deciding whether a feature belongs, and a working, tested module makes that question easy to skip.&lt;/p&gt;
&lt;p&gt;What finally got me to look was a newer feature overlapping it, and then opening the real files on a real site. Not the fixtures, not the tests: the folder a user would actually commit. If most of what’s in there wasn’t written by a person, it isn’t configuration, and it doesn’t belong in Git.&lt;/p&gt;
&lt;p&gt;The modules built around the removal all come from WordPress core: post types, taxonomies, post meta, user roles, block patterns. I can’t say what Loopress will need next. I do have a much sharper idea of what it is, and what it isn’t.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Tracking SEO plugin settings is covered in the &lt;a href=&quot;https://docs.loopress.dev/options/#seo-plugin-settings&quot;&gt;Options reference&lt;/a&gt;.&lt;/p&gt;
</content:encoded><category>product</category><category>story</category><category>configuration</category><category>wordpress</category></item><item><title>Astra vs Twenty Twenty-Five: 34% Fewer Queries on a Real Site</title><link>https://docs.loopress.dev/blog/astra-to-twenty-twenty-five-performance/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/astra-to-twenty-twenty-five-performance/</guid><description>My sister&apos;s tutoring site launched on Astra last year. I rebuilt it on Twenty Twenty-Five with Loopress and measured the homepage with Query Monitor before and after. A third fewer queries, 40 fewer scripts, half the autoloaded options, and a design that finally lives in Git.</description><pubDate>Wed, 30 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://nativefrenchteacher.com&quot;&gt;Native French Teacher&lt;/a&gt; is my sister’s online French tutoring business, and the site &lt;a href=&quot;https://docs.loopress.dev/blog/why-i-built-loopress/&quot;&gt;Loopress started from&lt;/a&gt;. It launched last year on &lt;strong&gt;Astra&lt;/strong&gt; with the Spectra blocks plugin. I recently rebuilt it on &lt;strong&gt;Twenty Twenty-Five&lt;/strong&gt;, the default block theme, with a new design along the way, using Loopress to manage the pages, templates and snippets from a Git repo.&lt;/p&gt;
&lt;p&gt;I didn’t do it for speed. I did it so the site would live in a repository. But I had Query Monitor open before and after, so here is what it measured.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;astra-was-the-right-call-at-first&quot;&gt;Astra was the right call, at first&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Let’s be fair to Astra. When you launch a site for a non-technical person, it’s hard to beat:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;header and footer builder&lt;/strong&gt; where you drag a logo, a menu and a button into place.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Global colors and typography&lt;/strong&gt; in the Customizer, with a live preview.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Per-page layout options&lt;/strong&gt;: hide the title, go full width, remove the sidebar, from a panel in the editor.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Starter templates&lt;/strong&gt; and Spectra’s blocks, so a decent-looking page takes minutes.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Twenty Twenty-Five on its own has none of that polish. It’s a clean block theme with a Site Editor, and the Site Editor saves everything in the database, just like Astra’s Customizer does. Swap one for the other and you’ve traded features for speed, but you still can’t answer “who changed the header, and what did it look like before?”&lt;/p&gt;
&lt;p&gt;That’s the gap Loopress fills.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;how-i-measured&quot;&gt;How I measured&lt;/h2&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Same Hostinger server, same PHP, same plugin stack apart from the theme and Spectra.&lt;/li&gt;
&lt;li&gt;Not the same pages: the rebuild came with a redesign. That matters most for what the browser downloads (images, fonts, layout), much less for the server work, which is mostly WordPress, the theme and the plugins.&lt;/li&gt;
&lt;li&gt;Homepage only, logged in as admin (Query Monitor needs that, so the admin bar is included in both runs).&lt;/li&gt;
&lt;li&gt;Several page loads per state, keeping the &lt;strong&gt;median&lt;/strong&gt;: &lt;strong&gt;cold&lt;/strong&gt; loads (first request after a while, OPcache and internal caches not warm) and &lt;strong&gt;warm&lt;/strong&gt; loads (right after). The screenshots below are the loads closest to that median.&lt;/li&gt;
&lt;li&gt;No page cache and no persistent object cache in either case. The site runs LiteSpeed Cache, but it doesn’t serve logged-in users, so these are the numbers a logged-in visitor actually gets. The query count barely moves between cold and warm, so the difference between the two is PHP warm-up, not a cache skipping work.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It’s a live site, not a lab, so small differences are noise. The large ones (queries, scripts, autoload) are not.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-homepage-side-by-side&quot;&gt;The homepage, side by side&lt;/h2&gt;&lt;/div&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Astra&lt;/th&gt;
&lt;th&gt;Twenty Twenty-Five&lt;/th&gt;
&lt;th&gt;Change&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Generation time, cold&lt;/td&gt;
&lt;td&gt;2.61 s&lt;/td&gt;
&lt;td&gt;1.92 s&lt;/td&gt;
&lt;td&gt;-26%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generation time, warm&lt;/td&gt;
&lt;td&gt;0.69 s&lt;/td&gt;
&lt;td&gt;0.50 s&lt;/td&gt;
&lt;td&gt;-28%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Peak memory, cold&lt;/td&gt;
&lt;td&gt;78.5 MB&lt;/td&gt;
&lt;td&gt;65.7 MB&lt;/td&gt;
&lt;td&gt;-16%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Peak memory, warm&lt;/td&gt;
&lt;td&gt;59.5 MB&lt;/td&gt;
&lt;td&gt;47.9 MB&lt;/td&gt;
&lt;td&gt;-19%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database queries, cold&lt;/td&gt;
&lt;td&gt;274&lt;/td&gt;
&lt;td&gt;182&lt;/td&gt;
&lt;td&gt;-34%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Time in database, cold&lt;/td&gt;
&lt;td&gt;55 ms&lt;/td&gt;
&lt;td&gt;38 ms&lt;/td&gt;
&lt;td&gt;-31%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enqueued scripts&lt;/td&gt;
&lt;td&gt;65&lt;/td&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;td&gt;-62%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enqueued styles&lt;/td&gt;
&lt;td&gt;52&lt;/td&gt;
&lt;td&gt;49&lt;/td&gt;
&lt;td&gt;-6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Object cache hits&lt;/td&gt;
&lt;td&gt;6,489&lt;/td&gt;
&lt;td&gt;4,137&lt;/td&gt;
&lt;td&gt;-36%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div&gt;&lt;figure&gt;&lt;starlight-image-zoom-zoomable&gt;&lt;img src=&quot;https://docs.loopress.dev/_astro/astra-overview-cold.DPr06upo_XAXhC.webp&quot; alt=&quot;Query Monitor overview with Astra, cold load: 2.61 s, 78.5 MB, 274 queries&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2940&quot; height=&quot;1330&quot;&gt;&lt;button aria-label=&quot;Zoom image: Query Monitor overview with Astra, cold load: 2.61 s, 78.5 MB, 274 queries&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;use href=&quot;#starlight-image-zoom-icon-zoom&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/button&gt;&lt;/starlight-image-zoom-zoomable&gt;&lt;figcaption&gt;Astra, cold load: 2.61 s, 274 queries, 65 scripts.&lt;/figcaption&gt;&lt;/figure&gt;&lt;figure&gt;&lt;starlight-image-zoom-zoomable&gt;&lt;img src=&quot;https://docs.loopress.dev/_astro/tt5-overview-cold.BSiPkedR_VVbwE.webp&quot; alt=&quot;Query Monitor overview with Twenty Twenty-Five, cold load: 1.92 s, 65.7 MB, 182 queries&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2940&quot; height=&quot;1346&quot;&gt;&lt;button aria-label=&quot;Zoom image: Query Monitor overview with Twenty Twenty-Five, cold load: 1.92 s, 65.7 MB, 182 queries&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;use href=&quot;#starlight-image-zoom-icon-zoom&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/button&gt;&lt;/starlight-image-zoom-zoomable&gt;&lt;figcaption&gt;Twenty Twenty-Five, cold load: 1.92 s, 182 queries, 25 scripts.&lt;/figcaption&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;starlight-image-zoom-zoomable&gt;&lt;img src=&quot;https://docs.loopress.dev/_astro/astra-overview-warm.BXASRQ79_ZNFFaW.webp&quot; alt=&quot;Query Monitor overview with Astra, warm load: 0.69 s, 59.5 MB, 282 queries&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2940&quot; height=&quot;1330&quot;&gt;&lt;button aria-label=&quot;Zoom image: Query Monitor overview with Astra, warm load: 0.69 s, 59.5 MB, 282 queries&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;use href=&quot;#starlight-image-zoom-icon-zoom&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/button&gt;&lt;/starlight-image-zoom-zoomable&gt;&lt;figcaption&gt;Astra, warm load: 0.69 s. The query count barely moves, so no cache is skipping work.&lt;/figcaption&gt;&lt;/figure&gt;&lt;figure&gt;&lt;starlight-image-zoom-zoomable&gt;&lt;img src=&quot;https://docs.loopress.dev/_astro/tt5-overview-warm.DFYsphEW_1GN2tB.webp&quot; alt=&quot;Query Monitor overview with Twenty Twenty-Five, warm load: 0.50 s, 47.9 MB, 182 queries&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2940&quot; height=&quot;1346&quot;&gt;&lt;button aria-label=&quot;Zoom image: Query Monitor overview with Twenty Twenty-Five, warm load: 0.50 s, 47.9 MB, 182 queries&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;use href=&quot;#starlight-image-zoom-icon-zoom&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/button&gt;&lt;/starlight-image-zoom-zoomable&gt;&lt;figcaption&gt;Twenty Twenty-Five, warm load: 0.50 s, same 182 queries.&lt;/figcaption&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The biggest single number is scripts: &lt;strong&gt;65 down to 25&lt;/strong&gt;. That’s mostly Astra and Spectra’s own scripts no longer being enqueued. Styles barely moved, because most of them come from plugins (forms, booking, quiz), not from the theme.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;where-the-time-went&quot;&gt;Where the time went&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Query Monitor’s timeline shows how long each WordPress hook took on a warm load.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Hook&lt;/th&gt;
&lt;th&gt;Astra&lt;/th&gt;
&lt;th&gt;Twenty Twenty-Five&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;plugins_loaded&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;141 ms&lt;/td&gt;
&lt;td&gt;138 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;after_setup_theme&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;28 ms&lt;/td&gt;
&lt;td&gt;26 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;init&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;91 ms&lt;/td&gt;
&lt;td&gt;78 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;wp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;32 ms&lt;/td&gt;
&lt;td&gt;6 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;template_redirect&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;16 ms&lt;/td&gt;
&lt;td&gt;51 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code dir=&quot;auto&quot;&gt;wp_head&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;81 ms&lt;/td&gt;
&lt;td&gt;31 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div&gt;&lt;figure&gt;&lt;starlight-image-zoom-zoomable&gt;&lt;img src=&quot;https://docs.loopress.dev/_astro/astra-timeline.DxR2rim__1NkOQ9.webp&quot; alt=&quot;Query Monitor timeline with Astra&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2932&quot; height=&quot;1600&quot;&gt;&lt;button aria-label=&quot;Zoom image: Query Monitor timeline with Astra&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;use href=&quot;#starlight-image-zoom-icon-zoom&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/button&gt;&lt;/starlight-image-zoom-zoomable&gt;&lt;figcaption&gt;Astra: &lt;code&gt;wp_head&lt;/code&gt; takes 81 ms.&lt;/figcaption&gt;&lt;/figure&gt;&lt;figure&gt;&lt;starlight-image-zoom-zoomable&gt;&lt;img src=&quot;https://docs.loopress.dev/_astro/tt5-timeline.CTnyYe9l_Z1d6Lh5.webp&quot; alt=&quot;Query Monitor timeline with Twenty Twenty-Five&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2932&quot; height=&quot;1600&quot;&gt;&lt;button aria-label=&quot;Zoom image: Query Monitor timeline with Twenty Twenty-Five&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;use href=&quot;#starlight-image-zoom-icon-zoom&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/button&gt;&lt;/starlight-image-zoom-zoomable&gt;&lt;figcaption&gt;Twenty Twenty-Five: &lt;code&gt;wp_head&lt;/code&gt; down to 31 ms, &lt;code&gt;template_redirect&lt;/code&gt; up to 51 ms, &lt;code&gt;plugins_loaded&lt;/code&gt; unchanged.&lt;/figcaption&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Three things stand out:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code dir=&quot;auto&quot;&gt;wp_head&lt;/code&gt; dropped from 81 ms to 31 ms.&lt;/strong&gt; Most likely Astra’s dynamic CSS and inline configuration, built at runtime on every request. A block theme ships its styles from &lt;code dir=&quot;auto&quot;&gt;theme.json&lt;/code&gt;, and WordPress only outputs the CSS for blocks actually on the page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code dir=&quot;auto&quot;&gt;template_redirect&lt;/code&gt; went up, from 16 ms to 51 ms.&lt;/strong&gt; Not everything got faster. Something hooked there now does more work, and it’s on my list to look at with the per-component view.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code dir=&quot;auto&quot;&gt;plugins_loaded&lt;/code&gt; didn’t move.&lt;/strong&gt; At 140 ms it’s the largest single chunk of the request, and changing the theme can’t touch it. The remaining plugin stack is now the thing to optimize, not the theme.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;h2 id=&quot;the-database-got-lighter-too&quot;&gt;The database got lighter too&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Every WordPress request loads all &lt;em&gt;autoloaded&lt;/em&gt; options into memory, whether the page needs them or not. Astra and Spectra stored a lot of their settings that way.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Astra&lt;/th&gt;
&lt;th&gt;Twenty Twenty-Five&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Autoloaded options size&lt;/td&gt;
&lt;td&gt;1,013 KB (946 options)&lt;/td&gt;
&lt;td&gt;519 KB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Big autoloaded options&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database size&lt;/td&gt;
&lt;td&gt;176 MB&lt;/td&gt;
&lt;td&gt;160 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Site Health&lt;/td&gt;
&lt;td&gt;Should be improved, 1 critical issue&lt;/td&gt;
&lt;td&gt;Good&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div&gt;&lt;figure&gt;&lt;starlight-image-zoom-zoomable&gt;&lt;img src=&quot;https://docs.loopress.dev/_astro/astra-autoload.C_WuZsDL_1He386.webp&quot; alt=&quot;Advanced DB Cleaner with Astra: autoload size is big, 1012.89 KB, 3 big options&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2617&quot; height=&quot;1176&quot;&gt;&lt;button aria-label=&quot;Zoom image: Advanced DB Cleaner with Astra: autoload size is big, 1012.89 KB, 3 big options&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;use href=&quot;#starlight-image-zoom-icon-zoom&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/button&gt;&lt;/starlight-image-zoom-zoomable&gt;&lt;figcaption&gt;Astra: 1,013 KB of options loaded on every request, 3 of them flagged as big.&lt;/figcaption&gt;&lt;/figure&gt;&lt;figure&gt;&lt;starlight-image-zoom-zoomable&gt;&lt;img src=&quot;https://docs.loopress.dev/_astro/tt5-autoload.Bv3SrOT4_ZeIExQ.webp&quot; alt=&quot;Advanced DB Cleaner with Twenty Twenty-Five: autoload size is good, 518.54 KB, 0 big options&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2617&quot; height=&quot;1184&quot;&gt;&lt;button aria-label=&quot;Zoom image: Advanced DB Cleaner with Twenty Twenty-Five: autoload size is good, 518.54 KB, 0 big options&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;use href=&quot;#starlight-image-zoom-icon-zoom&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/button&gt;&lt;/starlight-image-zoom-zoomable&gt;&lt;figcaption&gt;Twenty Twenty-Five: autoload down to 519 KB, no big options left.&lt;/figcaption&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Removing the theme and its companion plugin, then cleaning up what they left behind, &lt;strong&gt;halved the autoloaded data&lt;/strong&gt;. That was also the only critical issue in Site Health (“Autoloaded options could affect performance”), and it’s gone.&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;starlight-image-zoom-zoomable&gt;&lt;img src=&quot;https://docs.loopress.dev/_astro/astra-site-health.BlQzbWM6_ZEjQHw.webp&quot; alt=&quot;Site Health with Astra: should be improved, autoloaded options critical issue&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2618&quot; height=&quot;1438&quot;&gt;&lt;button aria-label=&quot;Zoom image: Site Health with Astra: should be improved, autoloaded options critical issue&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;use href=&quot;#starlight-image-zoom-icon-zoom&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/button&gt;&lt;/starlight-image-zoom-zoomable&gt;&lt;figcaption&gt;Astra: the autoloaded options are the one critical issue in Site Health.&lt;/figcaption&gt;&lt;/figure&gt;&lt;figure&gt;&lt;starlight-image-zoom-zoomable&gt;&lt;img src=&quot;https://docs.loopress.dev/_astro/tt5-site-health.Bd1bCD0W_2vQOlM.webp&quot; alt=&quot;Site Health with Twenty Twenty-Five: good&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2618&quot; height=&quot;1302&quot;&gt;&lt;button aria-label=&quot;Zoom image: Site Health with Twenty Twenty-Five: good&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;use href=&quot;#starlight-image-zoom-icon-zoom&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/button&gt;&lt;/starlight-image-zoom-zoomable&gt;&lt;figcaption&gt;Twenty Twenty-Five: Site Health is back to Good.&lt;/figcaption&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h2 id=&quot;what-about-visitors&quot;&gt;What about visitors?&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;I also ran PageSpeed Insights before and after, and it showed no major change. That’s not surprising: the site sits behind LiteSpeed Cache, and for visitors that’s the real game changer. Most pages are served straight from the cache, so the PHP work measured above rarely runs for them.&lt;/p&gt;
&lt;p&gt;So why care about server time at all? Because not every request can be cached:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Logged-in users.&lt;/strong&gt; A page cache only works for anonymous visitors. Once someone is logged in, every page they open is rendered by PHP, theme included, which is exactly what the numbers above measure. The site is going to have more logged-in users, so a theme that does less work per page is worth more every month.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cache purges.&lt;/strong&gt; Every purge, including the one after each deploy, means the next visitor gets an uncached page. PHP is usually still warm at that point, so that’s the warm render: 0.69 s on Astra, 0.50 s now.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Custom API routes.&lt;/strong&gt; With Loopress you can &lt;a href=&quot;https://docs.loopress.dev/api/&quot;&gt;add API routes&lt;/a&gt; to WordPress, and the ones that return personal or changing data can’t be cached. They don’t render a template, but they still boot WordPress, autoloaded options and all.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The cache hides the difference for anonymous visitors today. The lighter stack pays off for everything the cache can’t cover.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;twenty-twenty-five-alone-is-fast-with-loopress-its-also-manageable&quot;&gt;Twenty Twenty-Five alone is fast. With Loopress, it’s also manageable&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The page is about 30% faster on the server, uses a fifth less memory, runs a third fewer queries and ships 40 fewer scripts. None of it came from a caching plugin or a server upgrade: it came from removing layers.&lt;/p&gt;
&lt;p&gt;But a lean theme is only half the story. What made me comfortable dropping Astra is that everything it gave me through panels, Loopress gives me through files:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What Astra gave me&lt;/th&gt;
&lt;th&gt;Twenty Twenty-Five + Loopress&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Header and footer builder&lt;/td&gt;
&lt;td&gt;Template parts as block markup in &lt;code dir=&quot;auto&quot;&gt;theme/parts/&lt;/code&gt;, pushed into a child theme with &lt;a href=&quot;https://docs.loopress.dev/pages/#templates-and-parts&quot;&gt;&lt;code dir=&quot;auto&quot;&gt;lps theme template push&lt;/code&gt;&lt;/a&gt;. The parent theme stays untouched and keeps its updates.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Per-page layout options&lt;/td&gt;
&lt;td&gt;Custom page templates in &lt;code dir=&quot;auto&quot;&gt;theme/templates/&lt;/code&gt;, picked per page with a &lt;code dir=&quot;auto&quot;&gt;template:&lt;/code&gt; header. A bare landing page is one file.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Starter templates and Spectra blocks&lt;/td&gt;
&lt;td&gt;Pages written as &lt;a href=&quot;https://docs.loopress.dev/pages/&quot;&gt;plain HTML files&lt;/a&gt; in the repo, rendered by the theme, locked in wp-admin so Git stays the source of truth.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Custom code in &lt;code dir=&quot;auto&quot;&gt;functions.php&lt;/code&gt; or a snippet plugin&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://docs.loopress.dev/hooks/&quot;&gt;Hooks&lt;/a&gt; and &lt;a href=&quot;https://docs.loopress.dev/snippets/&quot;&gt;snippets&lt;/a&gt; as PHP files in Git.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;That split doesn’t take the editor away from my sister. She still writes her blog posts in the WordPress admin, and they live in the database like any other content. What moved to Git is the structure around them: templates, landing pages and code. She now also edits the site from Claude Desktop.&lt;/p&gt;
&lt;p&gt;Astra’s features are good, but they live in the database, next to the content, invisible to Git. On Twenty Twenty-Five with Loopress, the same decisions are files: I review them, diff them, push them to staging first, and &lt;a href=&quot;https://docs.loopress.dev/blog/undo-a-wordpress-deploy/&quot;&gt;roll them back&lt;/a&gt; when something goes wrong. The server does less work &lt;em&gt;and&lt;/em&gt; the design got a history.&lt;/p&gt;
&lt;p&gt;That’s the combo I’d pick for the next site: the default block theme for the performance, Loopress for everything Astra used to do in a panel.&lt;/p&gt;
&lt;p&gt;Still to do: install a persistent object cache (Redis is on the server, just not wired up) and look at that &lt;code dir=&quot;auto&quot;&gt;template_redirect&lt;/code&gt; regression.&lt;/p&gt;
&lt;p&gt;→ &lt;a href=&quot;https://docs.loopress.dev/wordpress-plugin/&quot;&gt;Get started with the plugin&lt;/a&gt; or &lt;a href=&quot;https://docs.loopress.dev/cli/&quot;&gt;the CLI&lt;/a&gt;&lt;/p&gt;</content:encoded><category>performance</category><category>block themes</category><category>query monitor</category><category>wordpress</category></item><item><title>Your WordPress Hooks Belong in Git, Not functions.php</title><link>https://docs.loopress.dev/blog/wordpress-hooks-in-git/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/wordpress-hooks-in-git/</guid><description>Every WordPress project has a pile of add_action and add_filter calls holding it together. They live in functions.php or a snippets plugin, invisible to code review. Loopress Full lets you ship them as plain PHP files in Git.</description><pubDate>Thu, 10 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;You want every blog post to end with a newsletter box. The code is four lines:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;add_filter&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;the_content&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;&lt;span&gt;content&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;is_singular&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;content&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;content&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt; do_shortcode&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;[newsletter_form]&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;});&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Writing it took a minute. The question that eats the rest of the hour: where does it go, and how does it get to staging and production without someone pasting it into an admin textarea?&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;where-hook-code-lives-today&quot;&gt;Where hook code lives today&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&lt;code dir=&quot;auto&quot;&gt;functions.php&lt;/code&gt;.&lt;/strong&gt; Fastest to write, tied to your theme. Switch themes, lose the hook. A year later it’s 900 lines of unrelated callbacks nobody wants to touch.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A site-specific plugin.&lt;/strong&gt; The clean answer, and now your four lines come wrapped in a plugin header, and you still need a way to get that plugin onto each environment and know which version runs where.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A snippets plugin.&lt;/strong&gt; Live in seconds, versioned never. The callback sits in the database, edited through a textarea, invisible to &lt;code dir=&quot;auto&quot;&gt;git log&lt;/code&gt;, invisible to code review. Someone tweaks the priority, something downstream breaks, and there is no diff to point at.&lt;/p&gt;
&lt;p&gt;The hook logic is never the hard part. The delivery is.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;one-file-one-class&quot;&gt;One file, one class&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;With &lt;a href=&quot;https://docs.loopress.dev/wordpress-plugin/&quot;&gt;Loopress Full&lt;/a&gt; installed, a hook is a plain PHP file in your repo’s &lt;code dir=&quot;auto&quot;&gt;hooks/&lt;/code&gt; directory:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;?&lt;/span&gt;&lt;span&gt;php&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;declare&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;strict_types&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;use&lt;/span&gt;&lt;span&gt; Loopress\Hooks\Attribute\&lt;/span&gt;&lt;span&gt;Filter&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;ContentHooks&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;#[Filter(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;the_content&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;, priority: &lt;/span&gt;&lt;span&gt;20&lt;/span&gt;&lt;span&gt;)]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;appendNewsletter&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&lt;span&gt;$content&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;is_singular&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;)) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$content&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$content&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;do_shortcode&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;[newsletter_form]&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Save it as &lt;code dir=&quot;auto&quot;&gt;hooks/content-hooks.php&lt;/code&gt; and deploy:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;hook&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;That is the whole thing. No plugin header, no &lt;code dir=&quot;auto&quot;&gt;add_filter&lt;/code&gt; call, no registration array. One class per file, named however you like (the name is read from the file’s own tokens, not its filename), and any public method carrying an &lt;code dir=&quot;auto&quot;&gt;#[Action]&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;#[Filter]&lt;/code&gt;, or &lt;code dir=&quot;auto&quot;&gt;#[Cron]&lt;/code&gt; attribute gets wired up. &lt;code dir=&quot;auto&quot;&gt;priority&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;acceptedArgs&lt;/code&gt; map straight onto the arguments you already know from &lt;a href=&quot;https://developer.wordpress.org/reference/functions/add_filter/&quot;&gt;&lt;code dir=&quot;auto&quot;&gt;add_filter()&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A &lt;code dir=&quot;auto&quot;&gt;#[Filter]&lt;/code&gt; method returns the value it receives, modified or not. An &lt;code dir=&quot;auto&quot;&gt;#[Action]&lt;/code&gt; returns nothing:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;use&lt;/span&gt;&lt;span&gt; Loopress\Hooks\Attribute\&lt;/span&gt;&lt;span&gt;Action&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;CacheHooks&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;#[Action(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;save_post&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;)]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;purgeOnSave&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;int&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&lt;span&gt;$postId&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;wp_remote_post&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;https://cdn.example.com/purge&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;body&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;path&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; get_permalink&lt;/span&gt;&lt;span&gt;($&lt;/span&gt;&lt;span&gt;postId&lt;/span&gt;&lt;span&gt;)],&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;]);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;A single class can carry as many of these as it wants, actions and filters mixed freely. Group them by what they touch, not by hook type.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;cron-without-wp-config-surgery&quot;&gt;Cron, without wp-config surgery&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The same file format runs scheduled work. &lt;code dir=&quot;auto&quot;&gt;#[Cron]&lt;/code&gt; takes a WordPress recurrence name:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;?&lt;/span&gt;&lt;span&gt;php&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;declare&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;strict_types&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;use&lt;/span&gt;&lt;span&gt; Loopress\Hooks\Attribute\&lt;/span&gt;&lt;span&gt;Cron&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;InvoiceCleanup&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;#[Cron(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;daily&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;)]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;purgeExpired&lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;// delete invoice drafts older than 30 days&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;recurrence&lt;/code&gt; is any schedule WordPress knows: the built-in &lt;code dir=&quot;auto&quot;&gt;hourly&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;twicedaily&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;daily&lt;/code&gt;, or a custom one registered through the &lt;a href=&quot;https://developer.wordpress.org/reference/hooks/cron_schedules/&quot;&gt;&lt;code dir=&quot;auto&quot;&gt;cron_schedules&lt;/code&gt;&lt;/a&gt; filter. The event is scheduled the first time the method is seen and left alone after that, so pushing the same file twice does not stack duplicate jobs.&lt;/p&gt;
&lt;p&gt;One sharp edge worth knowing up front: changing &lt;code dir=&quot;auto&quot;&gt;#[Cron(&apos;daily&apos;)]&lt;/code&gt; to &lt;code dir=&quot;auto&quot;&gt;#[Cron(&apos;hourly&apos;)]&lt;/code&gt; later does not reschedule the running event. Clear it yourself with &lt;a href=&quot;https://developer.wordpress.org/reference/functions/wp_clear_scheduled_hook/&quot;&gt;&lt;code dir=&quot;auto&quot;&gt;wp_clear_scheduled_hook()&lt;/code&gt;&lt;/a&gt; if you need the new interval to take effect now. If another part of your code needs to trigger the same job on demand, name the action yourself and &lt;code dir=&quot;auto&quot;&gt;do_action()&lt;/code&gt; it:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;#[Cron(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;daily&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;, hook: &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;acme_invoice_cleanup&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;)]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;purgeExpired&lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt; { &lt;/span&gt;&lt;span&gt;/* ... */&lt;/span&gt;&lt;span&gt; }&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h2 id=&quot;built-to-not-break-your-site&quot;&gt;Built to not break your site&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A hook has no URL and no permission check of its own. Once pushed it runs automatically every time WordPress fires the hook it is bound to, from &lt;code dir=&quot;auto&quot;&gt;init&lt;/code&gt; on every page load to &lt;code dir=&quot;auto&quot;&gt;save_post&lt;/code&gt; on every save, with nothing gating it. A mistake here affects everything that hits that hook, not one endpoint. Loopress keeps that contained:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code dir=&quot;auto&quot;&gt;lps hook push&lt;/code&gt; syntax-checks every file server-side and rejects broken PHP with the actual parse error, before anything is written. It also enforces one &lt;code dir=&quot;auto&quot;&gt;declare(strict_types=1);&lt;/code&gt;, exactly one class, and no class-name collision with another plugin.&lt;/li&gt;
&lt;li&gt;If a hook method throws at runtime, it is caught and logged rather than left to white-screen the site. An &lt;code dir=&quot;auto&quot;&gt;#[Action]&lt;/code&gt; simply does not run that time. A &lt;code dir=&quot;auto&quot;&gt;#[Filter]&lt;/code&gt; falls back to the original, unfiltered value.&lt;/li&gt;
&lt;li&gt;Files are protected from direct HTTP access. Pull them back and you get exactly the source you pushed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because these files call WordPress functions from a repo where WordPress is not installed, set up &lt;a href=&quot;https://docs.loopress.dev/editor-setup/&quot;&gt;editor stubs&lt;/a&gt; once for autocomplete and static analysis. The same page covers the &lt;a href=&quot;https://docs.loopress.dev/editor-setup/#loopress-attribute-classes&quot;&gt;&lt;code dir=&quot;auto&quot;&gt;loopress/php-attributes&lt;/code&gt;&lt;/a&gt; Composer package, which resolves the &lt;code dir=&quot;auto&quot;&gt;#[Action]&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;#[Filter]&lt;/code&gt;, and &lt;code dir=&quot;auto&quot;&gt;#[Cron]&lt;/code&gt; classes your IDE is about to ask about.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;hooks-your-repository-declares&quot;&gt;Hooks your repository declares&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Because hooks are plain files, the workflow is the one you already have:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;hook&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;pull&lt;/span&gt;&lt;span&gt;                       &lt;/span&gt;&lt;span&gt;# mirror what&apos;s on the site locally&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;git&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;checkout&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-b&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;add-newsletter-box&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;# branch, edit, open a PR&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;hook&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--dry-run&lt;/span&gt;&lt;span&gt;             &lt;/span&gt;&lt;span&gt;# see exactly what would change&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;hook&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;                       &lt;/span&gt;&lt;span&gt;# deploy&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;lps hook list&lt;/code&gt; prints what is live on a site. &lt;code dir=&quot;auto&quot;&gt;lps hook diff&lt;/code&gt; shows what differs between your local files and an environment, or between two environments, and it rolls up into the aggregate &lt;code dir=&quot;auto&quot;&gt;lps diff --only hook&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Across environments it is the same command with &lt;code dir=&quot;auto&quot;&gt;--env&lt;/code&gt;:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;hook&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--env&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;staging&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# looks right in staging&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;hook&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--env&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;production&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--yes&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;--yes&lt;/code&gt; is required outside a terminal because pushing to an environment named &lt;code dir=&quot;auto&quot;&gt;production&lt;/code&gt; asks for confirmation first. A local &lt;code dir=&quot;auto&quot;&gt;.php&lt;/code&gt; file whose hook no longer exists on the site is removed on the next &lt;code dir=&quot;auto&quot;&gt;pull&lt;/code&gt;, so the directory stays an honest mirror.&lt;/p&gt;
&lt;p&gt;Hooks stop being something you wire up on a site and become something your repository declares.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Hooks ship with Loopress Full, the free full edition of the plugin. Loopress Light does not include them.&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;npm&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;install&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-g&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;@loopress/cli&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The &lt;a href=&quot;https://docs.loopress.dev/hooks/&quot;&gt;documentation&lt;/a&gt; covers the full attribute reference, the cron scheduling model, and the push validation rules.&lt;/p&gt;
</content:encoded><category>hooks</category><category>wordpress</category><category>cron</category><category>git</category><category>php</category></item><item><title>How Loopress Light Got Into the WordPress.org Directory</title><link>https://docs.loopress.dev/blog/loopress-light-on-wordpress-org/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/loopress-light-on-wordpress-org/</guid><description>Submitted in July with code snippet sync, rejected, appealed, rejected again. Here is what the WordPress.org review team said, in their own words, and how Loopress Light ended up in the directory as an ACF and SEO sync tool instead.</description><pubDate>Sun, 06 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Loopress Light is now on the &lt;a href=&quot;https://wordpress.org/plugins/loopress-light/&quot;&gt;wordpress.org plugin directory&lt;/a&gt;. You install it from &lt;strong&gt;Plugins, Add New&lt;/strong&gt; in any WordPress admin, and it updates itself from there.&lt;/p&gt;
&lt;p&gt;Getting it accepted took an initial rejection, a failed appeal, and removing the feature the plugin was first built around. The &lt;a href=&quot;https://docs.loopress.dev/blog/wordpress-org-composer-rejection/&quot;&gt;Composer side of that story is here&lt;/a&gt;. This is the snippet sync half, mostly in the review team’s own words.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-first-no&quot;&gt;The first no&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;We submitted Loopress Light on 16 July 2026. That version carried code snippet sync: the CLI could push and pull &lt;a href=&quot;https://wordpress.org/plugins/code-snippets/&quot;&gt;Code Snippets&lt;/a&gt; and &lt;a href=&quot;https://wordpress.org/plugins/wpcode/&quot;&gt;WPCode&lt;/a&gt; entries over a REST API, so snippets could live in Git alongside the rest of a project.&lt;/p&gt;
&lt;p&gt;The rejection came back within a day, and it was categorical:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Your plugin has been rejected because we are not accepting plugins of this nature in most cases.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Script insertion plugins are amazing and powerful. They’re also incredibly dangerous and require a high level understanding of sanitization, security, and usage.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The directory rejects this whole category by default. Not this implementation, the category.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-appeal-and-why-it-lost&quot;&gt;The appeal, and why it lost&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;We wrote back the next day, arguing the mechanism was narrower than “an API that inserts scripts”:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Loopress Light never executes snippet code. It moves a snippet’s fields (name, code, type, location) into Code Snippets or WPCode through that plugin’s own API. Storage, sanitization, and execution all stay inside the plugin the site owner already installed for exactly that.&lt;/li&gt;
&lt;li&gt;It is inert on its own. If neither Code Snippets nor WPCode is active, every endpoint returns a 400 and the plugin does nothing.&lt;/li&gt;
&lt;li&gt;Access uses WordPress core’s own Application Passwords flow. The site owner approves the CLI on WordPress’s own authorization screen and can revoke it from their dashboard at any time. We do not ship an auth scheme.&lt;/li&gt;
&lt;li&gt;Every write is gated by &lt;code dir=&quot;auto&quot;&gt;current_user_can(&apos;manage_options&apos;)&lt;/code&gt;, the same capability already required to edit a snippet by hand.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The answer did not move:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The plugin provides REST endpoints through which arbitrary PHP, JavaScript, CSS, and other code can be remotely submitted and stored in Code Snippets or WPCode, where that code can then be executed. It therefore facilitates remote deployment of arbitrary executable code, even though the final execution occurs in another plugin.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And on the authentication argument specifically:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Application Passwords and manage_options checks establish who is authorized to make the request. They do not validate that the submitted code is safe, nor do they remove the inherent risks of providing an arbitrary-code deployment mechanism.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;We had also pointed at the snippet plugins already in the directory. That got a direct response too:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Those plugins were approved years ago, before real-world experience demonstrated the risks of this model. Removing established plugins now could cause greater harm to their existing users, but their continued presence is not a basis for accepting new plugins that provide or facilitate the same capability.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The takeaway: on this pattern, the directory does not weigh how good your authentication and capability checks are. The ability to deploy arbitrary code remotely is the thing they reject, wherever the execution finally lands.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;asking-instead-of-guessing&quot;&gt;Asking instead of guessing&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The rejection ended with a specific instruction: do not resubmit as is, and&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A materially different approach, such as providing only predefined, non-modifiable, thoroughly vetted operations rather than accepting arbitrary code, would need to be considered instead.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;We had recently built ACF and SCF configuration sync into the CLI: push and pull custom field groups, post types, taxonomies, and options pages as JSON. That is configuration data, not executable code. Rather than strip the plugin and resubmit blind, we described the new flow to the team, an external caller hitting a REST endpoint that maps JSON to ACF’s own API and nothing else, and asked whether it would clear the same bar.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Synchronizing ACF/SCF configuration represented as JSON would not, by itself, raise the same arbitrary executable-code concern as the rejected snippet synchronization feature. However, we cannot pre-approve a plugin from a description or workflow diagram.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;They listed what a full review would still check: that all snippet and arbitrary-code functionality was gone, that the synced data could not carry PHP, JS, CSS, or HTML, and that every REST endpoint had authentication, capability checks, validation, and sanitization. Not a green light, but enough to build against.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-rebuild&quot;&gt;The rebuild&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Snippet sync came out of the edition that ships to wordpress.org. Not disabled behind a flag: the code is physically absent from the zip, and a CI step unzips the built artifact and greps it for residue. The &lt;a href=&quot;https://docs.loopress.dev/blog/wordpress-org-composer-rejection/&quot;&gt;Composer post&lt;/a&gt; covers the one-codebase, two-artifact build in detail.&lt;/p&gt;
&lt;p&gt;Snippet sync, WPForms sync, custom REST API routes, and Composer dependency management all live in &lt;strong&gt;Loopress Full&lt;/strong&gt; now, distributed from &lt;a href=&quot;https://loopress.dev&quot;&gt;loopress.dev&lt;/a&gt;, never the directory. &lt;strong&gt;Loopress Light&lt;/strong&gt; is what was left: ACF and SEO configuration sync, plain JSON, over a &lt;code dir=&quot;auto&quot;&gt;loopress/v1&lt;/code&gt; REST API restricted to administrators.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;then-the-ordinary-review&quot;&gt;Then the ordinary review&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The resubmission cleared the policy question and hit a normal technical-issues pass. Two items:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Two inline &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;style&gt;&lt;/code&gt; blocks echoed straight into the admin page. Moved to &lt;code dir=&quot;auto&quot;&gt;wp_enqueue_style&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;wp_add_inline_style&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The top-level admin menu registered at position 6, sitting up among Posts and Media. Dropped to 100, below Settings.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Both were fixed in one commit, and after that Loopress Light was approved.&lt;/p&gt;
&lt;p&gt;Worth knowing if you are in this queue now: the review emails are partly automated (the team says so in the footer, and that no personal data is shared with the AI), and they ask for short replies that do not enumerate your changes, because they re-review the whole plugin regardless.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;which-edition-you-want&quot;&gt;Which edition you want&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;If you sync ACF field groups and SEO settings, install &lt;a href=&quot;https://wordpress.org/plugins/loopress-light/&quot;&gt;Loopress Light&lt;/a&gt; from the directory and let it update itself.&lt;/p&gt;
&lt;p&gt;If you also need snippet sync, WPForms sync, version-controlled REST API routes, or Composer packages managed from the admin, that is &lt;a href=&quot;https://docs.loopress.dev/wordpress-plugin/&quot;&gt;Loopress Full&lt;/a&gt;, a separate download, for the reasons above.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;thanks&quot;&gt;Thanks&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The review team was direct at every step, including the ones where the answer was no, and the citations were specific enough to act on each time. Answering the ACF question before a full resubmission is the part we are most grateful for. It turned a blind rebuild-and-hope into a scoped piece of work.&lt;/p&gt;
</content:encoded><category>wordpress</category><category>wordpress.org</category><category>acf</category><category>seo</category><category>security</category><category>open source</category></item><item><title>Embed a React App in a WordPress Page With One Shortcode</title><link>https://docs.loopress.dev/blog/embed-react-app-wordpress-shortcode/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/embed-react-app-wordpress-shortcode/</guid><description>Most &quot;SPA in WordPress&quot; setups fall apart on the second deploy. Here&apos;s how to ship a real React widget to a WordPress page, with content-hashed cache busting and one shortcode, using the lps app commands.</description><pubDate>Sat, 05 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;You want a real front-end app inside a WordPress page. A live product search, a booking widget, an interactive configurator, something React or Vue does well and PHP templates don’t. The moment you try to actually ship it, you hit a wall: WordPress wasn’t built to serve a Vite or webpack bundle, and every workaround feels like it fights the platform.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;how-people-try-to-solve-this-today&quot;&gt;How people try to solve this today&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Option 1: Paste the build into the theme&lt;/strong&gt;
Copy &lt;code dir=&quot;auto&quot;&gt;dist/assets/*.js&lt;/code&gt; into the theme, hand-edit &lt;code dir=&quot;auto&quot;&gt;functions.php&lt;/code&gt; to enqueue them. It works once. Then you rebuild, the filenames change (content hashes), and you’re back in &lt;code dir=&quot;auto&quot;&gt;functions.php&lt;/code&gt; updating script tags by hand. Switch themes and the app disappears.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Option 2: An iframe pointing at a separately hosted app&lt;/strong&gt;
Deploy the SPA to Vercel or Netlify, embed it with an &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;iframe&gt;&lt;/code&gt;. No PHP to touch, but now you’re running two deployments for one feature, styling is boxed off from the rest of the page, and calling WordPress data from the iframe means solving CORS and auth across two domains for no real reason.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Option 3: A custom plugin that hardcodes &lt;code dir=&quot;auto&quot;&gt;wp_enqueue_script&lt;/code&gt;&lt;/strong&gt;
Better than editing the theme, it survives a theme switch. But every new build still means editing PHP, bumping a version string by hand, and redeploying the plugin. There’s no local dev loop, no diff, no easy way to push the same build to staging before production.&lt;/p&gt;
&lt;p&gt;None of these give you the thing you actually want: build the app with its own toolchain, ship the output like you’d ship any other code, mount it with one line.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-loopress-approach&quot;&gt;The Loopress approach&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Loopress treats a built SPA as one more thing that syncs between your Git repo and WordPress, the same way it treats snippets or custom API routes. You build, Loopress ships the &lt;code dir=&quot;auto&quot;&gt;dist/&lt;/code&gt; folder over the REST API and gives you a shortcode to mount it. This is a &lt;a href=&quot;https://docs.loopress.dev/wordpress-plugin/&quot;&gt;Loopress Full&lt;/a&gt; feature.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;setup&quot;&gt;Setup&lt;/h3&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;npm&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;install&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-g&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;@loopress/cli&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;project&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;config&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;lps project config&lt;/code&gt; asks for your WordPress URL and handles authentication (an Application Password, created automatically via your browser or entered manually).&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;a-real-example-a-live-product-search-widget&quot;&gt;A real example: a live product search widget&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Say you run a WooCommerce shop and want an instant search box on a page: type a few letters, see matching products appear below without a page reload. A small React app is a better fit for that than a PHP template re-render on every keystroke.&lt;/p&gt;
&lt;p&gt;The directory layout:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;apps/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;search/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;loopress.app.json&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;dist/                       # npm run build output, this is what gets pushed&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span&gt;index.html&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span&gt;assets/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;index-9a597e0d.js&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span&gt;index-51910369.css&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;loopress.app.json&lt;/code&gt; can be empty, &lt;code dir=&quot;auto&quot;&gt;{}&lt;/code&gt;. Loopress derives the app’s name from the directory, reads the entry scripts and styles straight from &lt;code dir=&quot;auto&quot;&gt;dist/index.html&lt;/code&gt;, and defaults the mount point to &lt;code dir=&quot;auto&quot;&gt;#loopress-app-search&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Build it with its own toolchain, exactly like any other front-end project:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;npm&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--prefix&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;apps/search&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;run&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;build&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h3 id=&quot;push-it&quot;&gt;Push it&lt;/h3&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;app&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;search&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;Pushing apps to https://example.com&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;Apps path: apps&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;Found 1 app to push&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;search: uploaded 3 files, committed build 9f2a1c7b4e10&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;All apps pushed.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Only files whose content changed are uploaded, then the whole build is committed in one atomic step. The site keeps serving the previous build until that commit lands, so a failed push never leaves a half-deployed app.&lt;/p&gt;
&lt;p&gt;Want to see what would happen first?&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;app&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;search&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--dry-run&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[dry-run] search: would upload 3 files, then commit build 9f2a1c7b4e10&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h3 id=&quot;mount-it&quot;&gt;Mount it&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Drop the shortcode into any page or post:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[loopress_app name=&quot;search&quot;]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;WordPress renders the mount point and enqueues the content-hashed entry files with the build id as the cache-busting version:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&amp;#x3C;&lt;/span&gt;&lt;span&gt;div&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;id&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;loopress-app-search&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;data-loopress-app&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;search&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span&gt;div&lt;/span&gt;&lt;span&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h3 id=&quot;wire-it-to-real-woocommerce-data&quot;&gt;Wire it to real WooCommerce data&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;The shortcode also exposes a small config object your app reads at runtime, &lt;code dir=&quot;auto&quot;&gt;window.loopressApp_search&lt;/code&gt;:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;name: &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;search&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;mount: &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;#loopress-app-search&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;base: &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;https://example.com/wp-content/loopress/apps/search/&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;buildId: &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;9f2a1c7b4e10&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;restUrl: &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;https://example.com/wp-json/&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;restNonce: &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;a1b2c3d4e5&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Pair that with a &lt;a href=&quot;https://docs.loopress.dev/api/&quot;&gt;custom API route&lt;/a&gt; for the search endpoint itself. A minimal one, public since anonymous shoppers need to search too:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;api/search-products.php&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;?&lt;/span&gt;&lt;span&gt;php&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;declare&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;strict_types&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;SearchProducts&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;permission&lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;bool&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;true&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;WP_REST_Request&lt;/span&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&lt;span&gt;$request&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;array&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;$query&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;WP_Query&lt;/span&gt;&lt;span&gt;([&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;post_type&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;product&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;s&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; sanitize_text_field&lt;/span&gt;&lt;span&gt;((&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;request&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;get_param&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;q&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;)),&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;posts_per_page&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;10&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;]);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;array_map&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;fn&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;id&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;ID&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;name&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;post_title&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;price&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; get_post_meta&lt;/span&gt;&lt;span&gt;($&lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;ID&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;_price&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; true&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;                &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;url&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; get_permalink&lt;/span&gt;&lt;span&gt;($&lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;ID&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;],&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;query&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;posts&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;api&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The React app fetches &lt;code dir=&quot;auto&quot;&gt;restUrl + &apos;loopress-api/v1/search-products?q=...&apos;&lt;/code&gt; on every keystroke, with the &lt;code dir=&quot;auto&quot;&gt;restNonce&lt;/code&gt; header for authenticated calls if you need it later. Two independently deployable pieces, one page.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;checking-whats-live&quot;&gt;Checking what’s live&lt;/h3&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;app&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;list&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;Apps (1):&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;search&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Build:  9f2a1c7b4e10&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Files:  22 files, 2.44 MB&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Deployed: 2026-08-30T12:00:00+00:00&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h3 id=&quot;pulling-it-back-down&quot;&gt;Pulling it back down&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;New machine, or a teammate joining the project:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;app&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;pull&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;Pulling apps from https://example.com&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;Apps path: apps&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;search: 22 files (build 9f2a1c7b4e10)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;Pulled 1 app to apps&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h3 id=&quot;decommissioning-it&quot;&gt;Decommissioning it&lt;/h3&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;app&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;remove&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;search&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Deletes the bundle from &lt;code dir=&quot;auto&quot;&gt;wp-content/loopress/apps/&lt;/code&gt; and unregisters the shortcode. Local files are untouched, only the WordPress side is cleaned up.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;working-across-environments&quot;&gt;Working across environments&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Same pattern as everything else in Loopress: register each environment once with &lt;code dir=&quot;auto&quot;&gt;lps project config&lt;/code&gt;, then target one with &lt;code dir=&quot;auto&quot;&gt;--env&lt;/code&gt;.&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# ship to staging first&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;app&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;search&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--env&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;staging&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# looks right, ship to production&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;app&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;search&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--env&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;production&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--yes&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;--yes&lt;/code&gt; is required outside a terminal (CI, scripts) because pushing to an environment named &lt;code dir=&quot;auto&quot;&gt;production&lt;/code&gt; asks for confirmation first.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;things-to-keep-in-mind&quot;&gt;Things to keep in mind&lt;/h2&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hash routing only.&lt;/strong&gt; &lt;code dir=&quot;auto&quot;&gt;react-router&lt;/code&gt; or &lt;code dir=&quot;auto&quot;&gt;vue-router&lt;/code&gt; must run in hash mode (&lt;code dir=&quot;auto&quot;&gt;/page#/route&lt;/code&gt;). History-mode routing needs a server rewrite that would collide with WordPress permalinks, so it’s refused rather than half-supported.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;One generation of grace, no rollback.&lt;/strong&gt; On deploy, the previous build’s files are kept for one generation so a visitor mid-session doesn’t 404 on a lazy chunk. There’s no version history beyond that, so treat Git as your rollback mechanism, not WordPress.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Content-hashed filenames are required.&lt;/strong&gt; Vite and webpack do this by default. It’s what makes a new deploy bust every visitor’s cache safely.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;If you have a front-end app that belongs inside a WordPress page instead of bolted on beside it, the next step is &lt;code dir=&quot;auto&quot;&gt;apps/&amp;#x3C;name&gt;/dist&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;lps app push&lt;/code&gt;.&lt;/p&gt;
</content:encoded><category>spa</category><category>react</category><category>wordpress</category><category>javascript</category></item><item><title>Composer Packages in a WordPress REST API Route</title><link>https://docs.loopress.dev/blog/composer-packages-wordpress-rest-api-route/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/composer-packages-wordpress-rest-api-route/</guid><description>Composer dependency management and Custom API Routes were built as two separate Loopress Full features. They were also built to fit together. Here&apos;s the mechanism connecting them, and what it opens up.</description><pubDate>Mon, 03 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Two Loopress Full features, each useful on their own: &lt;a href=&quot;https://docs.loopress.dev/blog/wordpress-composer-without-ssh/&quot;&gt;Composer dependency management&lt;/a&gt; installs any Packagist package straight from the WordPress admin, and &lt;a href=&quot;https://docs.loopress.dev/blog/custom-wordpress-endpoint-without-writing-a-plugin/&quot;&gt;Custom API Routes&lt;/a&gt; turn a version-controlled PHP file into a live REST endpoint, deployed with the &lt;a href=&quot;https://docs.loopress.dev/getting-started/&quot;&gt;Loopress CLI&lt;/a&gt; once it’s set up for the project. They were built separately, but not independently: a route file can &lt;code dir=&quot;auto&quot;&gt;use&lt;/code&gt; any package Composer installed, no extra step in between.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;why-reach-for-a-package-at-all&quot;&gt;Why reach for a package at all&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;WP_Query&lt;/code&gt; (or &lt;code dir=&quot;auto&quot;&gt;get_posts()&lt;/code&gt;) already covers anything the site itself holds: posts, pages, meta, taxonomies. A Composer package earns its place in a route the moment a request needs something WordPress doesn’t have on its own: a currency rate from another service, a PDF built for a download link, a CSV parsed from an upload, a payload checked against a validation library before it touches the database. Once a route file can &lt;code dir=&quot;auto&quot;&gt;use&lt;/code&gt; a package, all of that is ordinary PHP, not a special case.&lt;/p&gt;
&lt;p&gt;This matters most when WordPress is used as a headless CMS: a separate frontend (Next.js, Astro) consuming &lt;code dir=&quot;auto&quot;&gt;wp-json&lt;/code&gt; and rendering nothing of its own. There’s no theme, no template, nowhere else for that logic to live, every capability a request needs has to be in the route itself. That’s exactly where a route being limited to what &lt;code dir=&quot;auto&quot;&gt;WP_Query&lt;/code&gt; already knows would start to hurt.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-line-you-dont-have-to-write&quot;&gt;The line you don’t have to write&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Using a Composer package anywhere else in WordPress, a snippet, &lt;code dir=&quot;auto&quot;&gt;functions.php&lt;/code&gt;, means loading the autoloader yourself first:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;require_once&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;WP_CONTENT_DIR&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;/loopress/vendor/autoload.php&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;use&lt;/span&gt;&lt;span&gt; GuzzleHttp\&lt;/span&gt;&lt;span&gt;Client&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;That line has to be there, in every file that touches a package, every time. Miss it and you get a fatal “Class not found” the moment the file runs.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;in-a-route-file-its-not-there&quot;&gt;In a route file, it’s not there&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A Custom API Route already goes through Loopress’s own loader before your code executes. That loader resolves the same &lt;code dir=&quot;auto&quot;&gt;wp-content/loopress/vendor/&lt;/code&gt; autoloader &lt;code dir=&quot;auto&quot;&gt;lps composer push&lt;/code&gt; fills, once, before your route class is even loaded, so a route file just uses a package like normal PHP:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;?&lt;/span&gt;&lt;span&gt;php&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;declare&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;strict_types&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;use&lt;/span&gt;&lt;span&gt; GuzzleHttp\&lt;/span&gt;&lt;span&gt;Client&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Webhook&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;array&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;$client&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Client&lt;/span&gt;&lt;span&gt;();&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;// ...&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;ok&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;true&lt;/span&gt;&lt;span&gt;];&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;No &lt;code dir=&quot;auto&quot;&gt;require_once&lt;/code&gt;, no path to get wrong, no difference between this and any Composer project you’ve worked on. The full reference is in &lt;a href=&quot;https://docs.loopress.dev/api/routes/#using-your-own-composer-dependencies&quot;&gt;Writing Route Files&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;if-the-package-isnt-there&quot;&gt;If the package isn’t there&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A corrupted or missing &lt;code dir=&quot;auto&quot;&gt;wp-content/loopress/vendor/autoload.php&lt;/code&gt; is caught and &lt;a href=&quot;https://docs.loopress.dev/api/routes/#failure-isolation&quot;&gt;logged&lt;/a&gt; once, before any route file loads, every other route still registers normally. A single package missing from an intact &lt;code dir=&quot;auto&quot;&gt;vendor/&lt;/code&gt;, Guzzle never installed, say, isn’t something Loopress catches on your behalf: it surfaces as an ordinary PHP error on that request, the same as calling any undefined class anywhere else in PHP. WordPress serves each request in its own process, so the error stays contained to the one endpoint that hit it, everything else on the site keeps working, but push the package before you push the route that depends on it.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-this-opens-up&quot;&gt;What this opens up&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Once the autoloader is a non-issue, the interesting question stops being “can I use a package here” and becomes “what’s worth building with one.” A route enriching WordPress content with a live external rate. One generating a file on demand instead of storing it. One validating a webhook payload before it’s trusted. Each of those deserves its own walkthrough with real code and a real deploy, not a paragraph here, so that’s what the rest of this series is for.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Both features ship with Loopress Full, free:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;npm&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;install&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-g&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;@loopress/cli&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;https://docs.loopress.dev/composer/&quot;&gt;Composer dependency management&lt;/a&gt; covers installing and auditing packages from the admin. &lt;a href=&quot;https://docs.loopress.dev/api/routes/&quot;&gt;Writing Route Files&lt;/a&gt; covers everything a route can do beyond this: authentication, CORS, the security model.&lt;/p&gt;
</content:encoded><category>composer</category><category>rest api</category><category>wordpress</category><category>php</category></item><item><title>Version Control Your WordPress Code Snippets</title><link>https://docs.loopress.dev/blog/version-control-wordpress-code-snippets/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/version-control-wordpress-code-snippets/</guid><description>Most WordPress developers manage their code snippets by editing them directly in the admin panel. Here&apos;s a better way, one that gives you full Git history and lets you deploy changes like any other codebase.</description><pubDate>Wed, 29 Jul 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;If you use &lt;a href=&quot;https://wordpress.org/plugins/code-snippets/&quot;&gt;Code Snippets&lt;/a&gt; or &lt;a href=&quot;https://wpcode.com/&quot;&gt;WPCode&lt;/a&gt;, you’re probably editing your PHP functions directly in the admin panel. Click the snippet, make the change, save. Done.&lt;/p&gt;
&lt;p&gt;It works. Until it doesn’t.&lt;/p&gt;
&lt;p&gt;Someone edits a snippet and breaks something. You don’t know what changed. There’s no history. You either remember what it looked like before, or you don’t. There’s no &lt;code dir=&quot;auto&quot;&gt;git log&lt;/code&gt;, no diff, no blame.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;how-people-try-to-solve-this-today&quot;&gt;How people try to solve this today&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The current options aren’t great.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Option 1: WPCodeBox or Code Snippets Cloud&lt;/strong&gt;
These tools offer built-in versioning: you can see a history of changes and revert. It works, but it’s locked inside their platform. Your code history lives in their database, not in your repo, and it doesn’t integrate with your existing Git workflow.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Option 2: Keeping snippets in your theme’s &lt;code dir=&quot;auto&quot;&gt;functions.php&lt;/code&gt;&lt;/strong&gt;
This at least puts the code in a file you can version. But it ties snippets to your theme, means they disappear on theme switch, and turns &lt;code dir=&quot;auto&quot;&gt;functions.php&lt;/code&gt; into an unorganized dumping ground.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Option 3: A custom plugin&lt;/strong&gt;
Some agencies build a site-specific plugin to hold all their custom code. This is better: it’s version-controlled and theme-independent. But it requires setup for every project and doesn’t give you a clean way to sync between environments.&lt;/p&gt;
&lt;p&gt;None of these feel like a real developer workflow.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-loopress-approach&quot;&gt;The Loopress approach&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Loopress treats your snippets as plain files in a Git repository. Pull them down from WordPress, edit them locally, push them back. Every change is a commit.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;setup&quot;&gt;Setup&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Install the Loopress CLI:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;npm&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;install&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-g&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;@loopress/cli&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Configure your project:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;project&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;config&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;It asks for a project name, an environment (production, staging, local, or a custom name), and your WordPress URL. By default it then opens your browser to authorize and creates an Application Password for you automatically, no copy-pasting a generated password. If that flow can’t complete, it falls back to asking for a WordPress username and an Application Password you generate yourself.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;pull-your-snippets&quot;&gt;Pull your snippets&lt;/h3&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;snippet&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;pull&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;This creates a &lt;code dir=&quot;auto&quot;&gt;snippets/&lt;/code&gt; directory with one &lt;code dir=&quot;auto&quot;&gt;.php&lt;/code&gt; file and one &lt;code dir=&quot;auto&quot;&gt;.json&lt;/code&gt; sidecar per snippet:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;snippets/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;1-my-custom-function.php&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;1-my-custom-function.json&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;2-woocommerce-checkout-tweak.php&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;2-woocommerce-checkout-tweak.json&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;3-disable-gutenberg.php&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;3-disable-gutenberg.json&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Each &lt;code dir=&quot;auto&quot;&gt;.php&lt;/code&gt; file contains the raw snippet code. The &lt;code dir=&quot;auto&quot;&gt;.json&lt;/code&gt; sidecar stores the metadata (id, name, type, active status, tags) that Loopress uses to identify and update the snippet on WordPress.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;edit-locally&quot;&gt;Edit locally&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Open any file in your editor. Make changes. The feedback loop is your local environment, not the WordPress admin panel.&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;git&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;add&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;snippets/2-woocommerce-checkout-tweak.php&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;git&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;commit&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-m&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;fix: apply discount code before tax calculation&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Now you have a commit. A diff. A message explaining why. This is reviewable, reversible, and shareable.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;push-back-to-wordpress&quot;&gt;Push back to WordPress&lt;/h3&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;snippet&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Loopress syncs your local files back to WordPress via the REST API. No FTP, no copy-paste.&lt;/p&gt;
&lt;p&gt;If you want to see what would change without actually changing anything:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;snippet&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--dry-run&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h2 id=&quot;working-across-environments&quot;&gt;Working across environments&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The real value shows up when you’re working with local, staging, and production environments. Register each one once with &lt;code dir=&quot;auto&quot;&gt;lps project config&lt;/code&gt;, then target any of them with &lt;code dir=&quot;auto&quot;&gt;--env&lt;/code&gt; on a single command:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# Pull from production&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;snippet&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;pull&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--env&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;production&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# Test locally, commit changes&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# Push to staging first&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;snippet&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--env&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;staging&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# When ready, push to production&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;snippet&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--env&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;production&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--yes&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;That trailing &lt;code dir=&quot;auto&quot;&gt;--yes&lt;/code&gt; isn’t optional flair: pushing to an environment literally named &lt;code dir=&quot;auto&quot;&gt;production&lt;/code&gt; asks for confirmation in a terminal, and requires &lt;code dir=&quot;auto&quot;&gt;--yes&lt;/code&gt; to skip that prompt outside one (CI, scripts). Without &lt;code dir=&quot;auto&quot;&gt;--env&lt;/code&gt;, commands target the &lt;code dir=&quot;auto&quot;&gt;local&lt;/code&gt; environment, so a push to a real site is always spelled out in the command itself.&lt;/p&gt;
&lt;p&gt;Your snippets flow between environments the same way your code does. No database exports, no manual copy-paste.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;one-thing-to-keep-in-mind&quot;&gt;One thing to keep in mind&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Loopress syncs snippets by ID (stored in the &lt;code dir=&quot;auto&quot;&gt;.json&lt;/code&gt; sidecar). If you pull first, the ID is saved and subsequent pushes update the correct snippet regardless of name changes. Without a sidecar ID, Loopress creates a new snippet. Treat the files as the source of truth once you’re in this workflow.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;If this resonates, the next step is &lt;code dir=&quot;auto&quot;&gt;lps project config&lt;/code&gt; and adding &lt;code dir=&quot;auto&quot;&gt;snippets/&lt;/code&gt; to your project’s Git repository. From there, every snippet change is a commit.&lt;/p&gt;
</content:encoded><category>code snippets</category><category>git</category><category>wordpress</category><category>beginners</category></item><item><title>Ship a Custom WordPress Endpoint Without Writing a Plugin</title><link>https://docs.loopress.dev/blog/custom-wordpress-endpoint-without-writing-a-plugin/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/custom-wordpress-endpoint-without-writing-a-plugin/</guid><description>Every WordPress project eventually needs a custom REST endpoint, a data feed for a frontend, a webhook receiver, an integration hook. Loopress Full now lets you ship one as a single PHP file in Git.</description><pubDate>Sun, 26 Jul 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Your JavaScript frontend needs a list of featured products from WordPress. Not the whole REST API surface, not raw post objects with forty fields, just the ten items the homepage carousel shows, shaped the way the frontend wants them.&lt;/p&gt;
&lt;p&gt;The endpoint is ten minutes of work: query, map, return. The question that eats the rest of the afternoon: where does that code go?&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;where-custom-endpoints-live-today&quot;&gt;Where custom endpoints live today&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&lt;code dir=&quot;auto&quot;&gt;functions.php&lt;/code&gt;.&lt;/strong&gt; Fastest to write, tied to your theme. Switch themes, lose the endpoint. Two years later it’s line 1400 of a file nobody wants to scroll.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A site-specific plugin.&lt;/strong&gt; The clean classic answer. But now your ten minutes of logic come wrapped in a plugin header, a hook, and a registration array:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;add_action&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;rest_api_init&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;register_rest_route&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;acme/v1&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;/featured-products&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;methods&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;             &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;GET&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;callback&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;acme_featured_products&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;permission_callback&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;__return_true&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;]);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;});&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;And you still need a way to get that plugin onto the site. And onto staging. And to know which version runs where.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A snippets plugin.&lt;/strong&gt; Deployed in seconds, versioned never. The code lives in the database, edited through an admin textarea, invisible to Git and code review.&lt;/p&gt;
&lt;p&gt;The endpoint logic is never the problem. The delivery vehicle is.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;one-file-one-route&quot;&gt;One file, one route&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;With &lt;a href=&quot;https://docs.loopress.dev/wordpress-plugin/&quot;&gt;Loopress Full&lt;/a&gt; installed, a custom endpoint is a single PHP file in your repo:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;?&lt;/span&gt;&lt;span&gt;php&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;declare&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;strict_types&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;class&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;FeaturedProducts&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;array&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;$query&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;WP_Query&lt;/span&gt;&lt;span&gt;([&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;post_type&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;      &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;product&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;meta_key&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;       &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;featured&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;meta_value&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;     &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;posts_per_page&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;10&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;]);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;array_map&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;fn&lt;/span&gt;&lt;span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;WP_Post&lt;/span&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;array&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;id&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;ID&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;title&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;post_title&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;url&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;   &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; get_permalink&lt;/span&gt;&lt;span&gt;($&lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;),&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;],&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;query&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;posts&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Save it as &lt;code dir=&quot;auto&quot;&gt;api/featured-products.php&lt;/code&gt; and deploy:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;api&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The conventions do all the wiring you saw above. The filename is the route. Each file declares exactly one class, named however you like (&lt;code dir=&quot;auto&quot;&gt;FeaturedProducts&lt;/code&gt; here, but &lt;code dir=&quot;auto&quot;&gt;Handler&lt;/code&gt; or anything else works the same), and each public method named after an HTTP verb (&lt;code dir=&quot;auto&quot;&gt;get&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;post&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;put&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;patch&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;delete&lt;/code&gt;) becomes that verb’s handler. No registration code, no plugin header, no hook.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;now-call-it&quot;&gt;Now call it&lt;/h2&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;curl&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;https://your-site.com/wp-json/loopress-api/v1/featured-products&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt;&quot;code&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;rest_forbidden&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;&quot;message&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;Sorry, you are not allowed to do that.&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;&quot;data&quot;&lt;/span&gt;&lt;span&gt;:{&lt;/span&gt;&lt;span&gt;&quot;status&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;401&lt;/span&gt;&lt;span&gt;}}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;That 401 is the feature. A fresh route requires an administrator, the same authentication the Loopress CLI itself uses. Nothing you push is publicly reachable by accident.&lt;/p&gt;
&lt;p&gt;For an endpoint another system calls on your behalf, a reporting script, an internal dashboard, a cron job, that default is already the right answer: the caller authenticates with an &lt;a href=&quot;https://docs.loopress.dev/application-passwords/&quot;&gt;application password&lt;/a&gt; over Basic auth, and you have a protected endpoint without writing a single line of security code.&lt;/p&gt;
&lt;p&gt;This feed, though, is meant for the browser. Making it public is a decision, so it’s expressed where decisions belong, in the file, in the diff, in code review:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;permission&lt;/span&gt;&lt;span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;WP_REST_Request&lt;/span&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&lt;span&gt;$request&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;bool&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;true&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;curl&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;https://your-site.com/wp-json/loopress-api/v1/featured-products&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[{&lt;/span&gt;&lt;span&gt;&quot;id&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;231&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;&quot;title&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;Weekender Backpack&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;&quot;url&quot;&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;https://your-site.com/product/weekender-backpack&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;}]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;One greppable line. A reviewer seeing this diff knows exactly what’s being opened to the world, which is not something you can say about a checkbox in an admin screen. The same &lt;code dir=&quot;auto&quot;&gt;permission()&lt;/code&gt; method receives the request directly, so routes that need their own rules, logged-in users only, a capability check, a signed webhook, express them the same way (the &lt;a href=&quot;https://docs.loopress.dev/api/routes/&quot;&gt;docs&lt;/a&gt; cover those patterns).&lt;/p&gt;
&lt;p&gt;The frontend lives on another domain? Declare CORS headers in the file too, they apply to every request, preflight included:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;headers&lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;array&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;Access-Control-Allow-Origin&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;https://app.example.com&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;];&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Need an HTTP client or an SDK in a route? If the site uses &lt;a href=&quot;https://docs.loopress.dev/composer/&quot;&gt;Loopress’s Composer integration&lt;/a&gt;, your packages are directly available to &lt;code dir=&quot;auto&quot;&gt;use&lt;/code&gt; in route files. No manual autoloader loading.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;built-to-not-break-your-site&quot;&gt;Built to not break your site&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Deployed code that runs inside WordPress has one non-negotiable requirement: a mistake must stay contained.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code dir=&quot;auto&quot;&gt;lps api push&lt;/code&gt; syntax-checks every file server-side and rejects broken PHP with the actual parse error, before anything is written.&lt;/li&gt;
&lt;li&gt;A file that still fails at runtime (a class collision with another plugin, a throwing dependency) is skipped and logged. Every other route, and the rest of the site’s REST API, keeps working.&lt;/li&gt;
&lt;li&gt;Files are protected from direct HTTP access and written atomically. Pull them back and you get exactly the source you wrote.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;h2 id=&quot;endpoints-your-repository-declares&quot;&gt;Endpoints your repository declares&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Because routes are plain files, everything you already do with code applies:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;api&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;pull&lt;/span&gt;&lt;span&gt;                  &lt;/span&gt;&lt;span&gt;# mirror what&apos;s on the site locally&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;git&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;checkout&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-b&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;add-feed&lt;/span&gt;&lt;span&gt;      &lt;/span&gt;&lt;span&gt;# branch, edit, review&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;api&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;span&gt;                  &lt;/span&gt;&lt;span&gt;# deploy&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Different environments? Push the same files to staging first, then production, like the rest of your Loopress-managed configuration. Endpoints stop being something you set up on a site and become something your repository declares.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Custom API Routes ship with Loopress Full, the free full edition of the plugin:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;npm&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;install&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-g&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;@loopress/cli&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The &lt;a href=&quot;https://docs.loopress.dev/api/&quot;&gt;documentation&lt;/a&gt; covers the complete file reference: request handling, response types, authentication, CORS, namespaces, and the security model.&lt;/p&gt;
</content:encoded><category>rest api</category><category>wordpress</category><category>git</category></item><item><title>Installing Composer Packages in WordPress Without SSH</title><link>https://docs.loopress.dev/blog/wordpress-composer-without-ssh/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/wordpress-composer-without-ssh/</guid><description>Need to pull in a Packagist package on a WordPress site? The usual path is SSH into the server, install Composer, run composer require, and pray. The Loopress plugin does this from the admin panel.</description><pubDate>Wed, 22 Jul 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;You need to add a PHP dependency to a WordPress site. Maybe a PDF generation library, a CSV parser, an image manipulation package. Something available on Packagist.&lt;/p&gt;
&lt;p&gt;Here’s what the standard workflow looks like.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-current-workflow&quot;&gt;The current workflow&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;If you’re on managed hosting (most clients are):&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check if SSH is available (often it isn’t, or it requires upgrading the hosting plan)&lt;/li&gt;
&lt;li&gt;If SSH is available: connect, check if Composer is installed, install it if not&lt;/li&gt;
&lt;li&gt;Navigate to the WordPress root&lt;/li&gt;
&lt;li&gt;Initialize &lt;code dir=&quot;auto&quot;&gt;composer.json&lt;/code&gt; if it doesn’t exist&lt;/li&gt;
&lt;li&gt;Run &lt;code dir=&quot;auto&quot;&gt;composer require vendor/package&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Hope the server’s PHP version matches your local environment&lt;/li&gt;
&lt;li&gt;Hope the &lt;code dir=&quot;auto&quot;&gt;vendor/&lt;/code&gt; directory ends up in the right place&lt;/li&gt;
&lt;li&gt;Repeat for every site, every environment&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This is assuming nothing goes wrong. In practice, you’ll hit permission issues, PHP version mismatches, or a host that simply blocks Composer from running.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The workaround people actually use:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Run Composer locally, then upload the &lt;code dir=&quot;auto&quot;&gt;vendor/&lt;/code&gt; directory to the server via FTP or rsync. This works but means you’re manually syncing binary files, and the next developer who needs to add a dependency starts from scratch figuring out where everything lives.&lt;/p&gt;
&lt;p&gt;Neither option is good.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-loopress-does-differently&quot;&gt;What Loopress does differently&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Loopress Full&lt;/strong&gt; adds a &lt;strong&gt;Dependency Management&lt;/strong&gt; panel to your WordPress admin. It talks to Packagist, runs Composer server-side through a sandboxed process, and handles the install without you needing a terminal or SSH access.&lt;/p&gt;
&lt;p&gt;This is Loopress Full specifically, not Loopress Light (the free edition on wordpress.org). wordpress.org’s plugin guidelines don’t allow a plugin to install executable code from a third-party registry like Packagist, so this feature ships separately, from &lt;a href=&quot;https://loopress.dev&quot;&gt;loopress.dev&lt;/a&gt;, rather than the official directory. &lt;a href=&quot;https://docs.loopress.dev/blog/wordpress-org-composer-rejection/&quot;&gt;Here’s why&lt;/a&gt;, if you’re curious.&lt;/p&gt;
&lt;div&gt;&lt;a href=&quot;https://github.com/loopress/loopress/releases/download/wordpress-plugin%402026.19.0/loopress-full.zip&quot;&gt;Download loopress-full.zip&lt;svg aria-hidden=&quot;true&quot; width=&quot;16&quot; height=&quot;16&quot; viewBox=&quot;0 0 24 24&quot; fill=&quot;currentColor&quot;&gt;&lt;path d=&quot;M8.29 13.29a1 1 0 0 0 0 1.42l3 3a1 1 0 0 0 1.42 0l3-3a1 1 0 0 0-1.42-1.42L13 14.59V3a1 1 0 0 0-2 0v11.59l-1.29-1.3a1 1 0 0 0-1.42 0ZM18 9h-2a1 1 0 0 0 0 2h2a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1h2a1 1 0 0 0 0-2H6a3 3 0 0 0-3 3v7a3 3 0 0 0 3 3h12a3 3 0 0 0 3-3v-7a3 3 0 0 0-3-3Z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a href=&quot;https://github.com/loopress/loopress/releases/tag/wordpress-plugin%402026.19.0&quot;&gt;v2026.19.0 release notes&lt;svg aria-hidden=&quot;true&quot; width=&quot;16&quot; height=&quot;16&quot; viewBox=&quot;0 0 24 24&quot; fill=&quot;currentColor&quot;&gt;&lt;path d=&quot;M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3Z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;h3 id=&quot;installing-a-package&quot;&gt;Installing a package&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Here’s what that looks like from the admin, in under a minute:&lt;/p&gt;
&lt;video controls width=&quot;100%&quot; src=&quot;/_astro/composer-install-admin-ui.C3Qf4-Nq.webm&quot;&gt;&lt;p&gt;Your browser doesn’t support HTML5 video. &lt;a href=&quot;https://docs.loopress.dev/_astro/composer-install-admin-ui.C3Qf4-Nq.webm&quot;&gt;Download the video&lt;/a&gt; instead.&lt;/p&gt;&lt;/video&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;WordPress Admin → Loopress → Dependencies&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Search for a package by name (&lt;code dir=&quot;auto&quot;&gt;guzzlehttp/guzzle&lt;/code&gt;, or whatever you need). Loopress queries Packagist directly and shows you available versions.&lt;/li&gt;
&lt;li&gt;Select the version, click &lt;strong&gt;Install&lt;/strong&gt;. Loopress runs &lt;code dir=&quot;auto&quot;&gt;composer require&lt;/code&gt; on the server and installs the package into a managed &lt;code dir=&quot;auto&quot;&gt;vendor/&lt;/code&gt; directory inside the plugin’s scope.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;&lt;h3 id=&quot;using-it-in-a-snippet&quot;&gt;Using it in a snippet&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Require the autoloader once, then use the package like any other Composer dependency. Here it is fetching and displaying data from an API in a code snippet:&lt;/p&gt;
&lt;video controls width=&quot;100%&quot; src=&quot;/_astro/snippet-using-composer.dziTNNCU.webm&quot;&gt;&lt;p&gt;Your browser doesn’t support HTML5 video. &lt;a href=&quot;https://docs.loopress.dev/_astro/snippet-using-composer.dziTNNCU.webm&quot;&gt;Download the video&lt;/a&gt; instead.&lt;/p&gt;&lt;/video&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;require_once&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;WP_CONTENT_DIR&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;/loopress/vendor/autoload.php&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;use&lt;/span&gt;&lt;span&gt; GuzzleHttp\&lt;/span&gt;&lt;span&gt;Client&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;add_filter&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;the_content&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;&lt;span&gt;content&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;in_the_loop&lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;||&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;is_main_query&lt;/span&gt;&lt;span&gt;())&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;content&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;client&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Client&lt;/span&gt;&lt;span&gt;();&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;response&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;client&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;https://jsonplaceholder.typicode.com/posts&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;query&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;_limit&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;5&lt;/span&gt;&lt;span&gt;]]);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;posts&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;json_decode&lt;/span&gt;&lt;/span&gt;&lt;span&gt;($&lt;/span&gt;&lt;span&gt;response&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;getBody&lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt;-&gt;&lt;/span&gt;&lt;span&gt;getContents&lt;/span&gt;&lt;span&gt;(),&lt;/span&gt;&lt;span&gt; true&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;list&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;&amp;#x3C;ul&gt;&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;foreach&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;($&lt;/span&gt;&lt;span&gt;posts&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;as&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;        &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;list&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;&amp;#x3C;li style=&quot;color: red&quot;&gt;&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt; esc_html&lt;/span&gt;&lt;span&gt;($&lt;/span&gt;&lt;span&gt;post&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;title&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;])&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;&amp;#x3C;/li&gt;&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;list&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;&amp;#x3C;/ul&gt;&lt;/span&gt;&lt;span&gt;&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;content&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;list&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;});&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h3 id=&quot;why-this-matters-for-agencies&quot;&gt;Why this matters for agencies&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;If you manage multiple client sites, the usual Composer workflow means either:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Maintaining SSH access to every server&lt;/li&gt;
&lt;li&gt;Teaching clients how to run terminal commands (not happening)&lt;/li&gt;
&lt;li&gt;Keeping a pile of FTP credentials and manually uploading &lt;code dir=&quot;auto&quot;&gt;vendor/&lt;/code&gt; directories&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With Loopress, the dependency management surface moves into the WordPress admin. You can install, update, and remove packages from the same interface you use to manage everything else. No server access required.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;seeing-whats-installed&quot;&gt;Seeing what’s installed&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;Dependencies&lt;/strong&gt; panel shows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All installed packages with their current versions&lt;/li&gt;
&lt;li&gt;Available updates from Packagist&lt;/li&gt;
&lt;li&gt;A one-click update path&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is the equivalent of &lt;code dir=&quot;auto&quot;&gt;composer show&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;composer outdated&lt;/code&gt;, surfaced in the UI.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-loopress-doesnt-replace&quot;&gt;What Loopress doesn’t replace&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Loopress’s dependency management is designed for adding libraries to a running WordPress site, pulling in packages that your snippets or custom code need. It’s not a replacement for a full Bedrock/Composer setup where WordPress itself is a Composer dependency.&lt;/p&gt;
&lt;p&gt;If you’re building on &lt;a href=&quot;https://roots.io/bedrock/&quot;&gt;Roots/Bedrock&lt;/a&gt;, you already have a proper Composer workflow and probably don’t need this. Loopress fills the gap for the other 90% of WordPress sites that aren’t running a full stack framework: sites on shared hosting, client sites where the server environment is opaque, or projects where “set up Bedrock” isn’t a conversation you can have.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Loopress Full is a free download, installed like any other plugin zip (&lt;strong&gt;Plugins → Add New → Upload Plugin&lt;/strong&gt;), no server configuration required. If you only need ACF and SEO sync, Loopress Light is the free edition on the wordpress.org directory instead.&lt;/p&gt;</content:encoded><category>composer</category><category>php</category><category>wordpress</category><category>dependencies</category></item><item><title>Why wordpress.org Won&apos;t Let You Install Composer Packages From a Plugin</title><link>https://docs.loopress.dev/blog/wordpress-org-composer-rejection/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/wordpress-org-composer-rejection/</guid><description>We built a Composer UI for the WordPress admin, then asked wordpress.org&apos;s review team if it belonged in the official directory. Guideline 8 says no, dynamically installed executable code is never acceptable there, no matter how it&apos;s used. Here&apos;s the rule, and the one-codebase, two-edition architecture we shipped instead.</description><pubDate>Thu, 16 Jul 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;WordPress doesn’t have a package manager. If you want a PHP library in your project, be it Guzzle for HTTP calls or a PDF generation library in a snippet, you’re either vendoring the code by hand or running Composer somewhere the WordPress admin can’t see.&lt;/p&gt;
&lt;p&gt;We built a feature to fix that: a Composer UI inside the WordPress admin. Search Packagist, install a package, audit it for known vulnerabilities, all without SSH access (&lt;a href=&quot;https://docs.loopress.dev/blog/wordpress-composer-without-ssh/&quot;&gt;full walkthrough here&lt;/a&gt;). Before shipping it, we asked the wordpress.org plugin review team whether it would be acceptable in the official directory.&lt;/p&gt;
&lt;p&gt;The answer was no.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-rule&quot;&gt;The rule&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Here’s the relevant line from Guideline 8 of the wordpress.org plugin directory:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“Plugins may not send executable code via third-party systems.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Installing a PHP package from Packagist is, by definition, downloading executable code from a third party and writing it to disk. It doesn’t matter that our plugin never calls the installed code’s autoloader itself, that the user has to load it deliberately from their own snippet. The review team was clear: the indirection changes nothing. The mere presence of that capability is enough to trigger the rule, whether or not it’s ever used. There’s no folder you can hide it in that makes it acceptable, they weren’t shy about saying that outright.&lt;/p&gt;
&lt;p&gt;If you want PHP dependencies in a plugin distributed on wordpress.org, the only accepted path is to vendor them at submission time: ship the code, with a compatible license and readable source, not fetch it dynamically.&lt;/p&gt;
&lt;p&gt;For us, that meant Composer package management could never live in the same plugin that ships on wordpress.org. Full stop, no clever workaround changes that.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-we-tried-first-and-undid&quot;&gt;What we tried first, and undid&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Our first move was the obvious one: split into two plugins. A “Core” plugin with snippet sync, distributed on wordpress.org, and a “Plus” plugin with Composer management, distributed separately, with the two detecting each other at runtime.&lt;/p&gt;
&lt;p&gt;We built it. Two npm packages, two &lt;code dir=&quot;auto&quot;&gt;composer.json&lt;/code&gt; files, two QA configs, two release pipelines, a filter contract between them so Plus could register itself with Core. Tests passed on both. Then we looked at what we’d actually built and reverted the whole thing the same day.&lt;/p&gt;
&lt;p&gt;The duplication cost more than the split saved us. Every config file, every CI job, every README existed twice for no product reason. Worse, one version of the idea we considered, Core dynamically loading Plus’s code, would have reintroduced the exact pattern the review team had just told us was the problem. That one wasn’t even a contender once we thought it through.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-we-shipped-instead&quot;&gt;What we shipped instead&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;One codebase. Two build artifacts.&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;wordpress-plugin/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;├── src/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;│   ├── Module/, Service/, RestApi/    snippet sync, shared by both editions&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;│   └── Dependencies/                  all Composer code, this directory&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;│                                      is physically absent from the&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;│                                      wordpress.org build, not just inactive&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;├── frontend/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;│   ├── full/    → App.tsx             Composer UI lives here&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;│   └── light/   → LightApp.tsx        never imports anything from Dependencies/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;└── scripts/build-flavor.cjs           assembles each edition and zips it&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;pnpm pack:light&lt;/code&gt; produces &lt;strong&gt;Loopress Light&lt;/strong&gt;: snippet sync only, no Composer code anywhere in the zip, not dead code, not a disabled feature flag, physically not present. &lt;code dir=&quot;auto&quot;&gt;composer.json&lt;/code&gt; in that build ships with an empty &lt;code dir=&quot;auto&quot;&gt;require&lt;/code&gt;. A CI step unzips the artifact after the build and greps it for Composer residue, because trusting the build script to get this right isn’t good enough when the whole point is a compliance boundary.&lt;/p&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;pnpm pack:full&lt;/code&gt; produces &lt;strong&gt;Loopress Full&lt;/strong&gt;: everything, including the package installer, the security audit, and CLI sync for your &lt;code dir=&quot;auto&quot;&gt;composer.json&lt;/code&gt;/&lt;code dir=&quot;auto&quot;&gt;composer.lock&lt;/code&gt;. It’s distributed from our own site, never wordpress.org, and its plugin header sets an &lt;code dir=&quot;auto&quot;&gt;Update URI&lt;/code&gt; that stops wordpress.org from ever pushing an update over it by mistake. If Loopress Light is already active on a site, activating Loopress Full deactivates it. The two editions don’t coexist. Full replaces Light, it doesn’t sit next to it.&lt;/p&gt;
&lt;p&gt;This is the same model ACF and Elementor use for their free/pro split: one codebase, one build script, two artifacts with a real feature boundary between them, not a paywall drawn in the UI.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-honest-tradeoff&quot;&gt;The honest tradeoff&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;If you only need snippet sync, Loopress Light is a free wordpress.org install, same as any other plugin in the directory. If you want Composer packages managed from WordPress without SSH, that’s Loopress Full (&lt;a href=&quot;https://docs.loopress.dev/blog/wordpress-composer-without-ssh/&quot;&gt;see how it works&lt;/a&gt;), a separate download from our site, precisely because wordpress.org’s own rules don’t allow that capability to live there. We’d rather tell you that upfront than have you discover it after installing the wrong one.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;thanks&quot;&gt;Thanks&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Credit where it’s due: the wordpress.org plugins review team answered our question directly and quickly, before we’d submitted anything. That single clear answer, citing the exact guideline, saved us from finding out the hard way through a full submission and rejection cycle. Loopress Light is in review now, built around that answer from the start.&lt;/p&gt;
</content:encoded><category>composer</category><category>wordpress</category><category>wordpress.org</category><category>open source</category></item><item><title>WordPress Has a DX Problem, and Developers Are Paying for It</title><link>https://docs.loopress.dev/blog/wordpress-has-a-dx-problem/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/wordpress-has-a-dx-problem/</guid><description>WordPress is powerful. But if you&apos;re a developer, working with it can feel like you&apos;re fighting the tool instead of building with it. Here&apos;s why, and what to do about it.</description><pubDate>Wed, 08 Jul 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;WordPress is remarkable. It powers well over 40% of all websites, according to &lt;a href=&quot;https://w3techs.com/technologies/details/cm-wordpress&quot;&gt;W3Techs&lt;/a&gt;. Your clients love it. Their non-technical staff can update content without calling you. The plugin ecosystem is enormous.&lt;/p&gt;
&lt;p&gt;But if you’re a developer, the moment you sit down to &lt;em&gt;build&lt;/em&gt; with WordPress, something feels off.&lt;/p&gt;
&lt;p&gt;You’re editing files directly on the server. You’re copy-pasting snippets from the admin panel. You’re hoping you remember what you changed last week. You’re sending a colleague a zip file with the “latest version” of some PHP function.&lt;/p&gt;
&lt;p&gt;None of this is how modern software is built. And yet, it’s the default WordPress workflow. This is the gap Loopress exists to close, and it’s worth understanding exactly where the friction comes from before looking at how to fix it.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-is-developer-experience&quot;&gt;What is developer experience?&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Developer experience (DX) refers to how smooth (or painful) it is to work with a tool as a developer. Good DX means: fast feedback loops, predictable environments, version-controlled code, and reproducible deployments.&lt;/p&gt;
&lt;p&gt;Think of how you work with a modern JavaScript project:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Code lives in Git&lt;/li&gt;
&lt;li&gt;Dependencies are declared in &lt;code dir=&quot;auto&quot;&gt;package.json&lt;/code&gt; and locked in &lt;code dir=&quot;auto&quot;&gt;package-lock.json&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;You run &lt;code dir=&quot;auto&quot;&gt;npm install&lt;/code&gt; and the project works&lt;/li&gt;
&lt;li&gt;Staging and production match because the environment is defined in code&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now think about a typical WordPress project:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Snippets are stored in a database, edited through a UI&lt;/li&gt;
&lt;li&gt;PHP packages require SSH access to install&lt;/li&gt;
&lt;li&gt;“Deploying” means FTP or a database export&lt;/li&gt;
&lt;li&gt;Staging and production drift apart over time because changes happen manually in both&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This isn’t a criticism of WordPress as a product; it was built for a different audience. But developers using it to build things deserve better.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-can-go-wrong&quot;&gt;What can go wrong&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Here’s a real scenario: you add a PHP snippet to your WordPress site using the Code Snippets plugin. It works. Three months later, a junior dev edits it and introduces a bug that takes checkout down for an hour. You have no idea what changed, when, or why. There’s no diff, no history, no rollback button. You dig through admin logs hoping to find something, then end up rewriting the snippet from memory.&lt;/p&gt;
&lt;p&gt;Or: a client wants a PDF export feature. You need to pull in a Packagist package. You SSH into the server, install Composer, run &lt;code dir=&quot;auto&quot;&gt;composer require&lt;/code&gt;, and pray nothing breaks in production. It worked, but it was thirty minutes of friction that shouldn’t exist.&lt;/p&gt;
&lt;p&gt;These aren’t edge cases. They’re the everyday reality of WordPress development.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-a-better-workflow-looks-like&quot;&gt;What a better workflow looks like&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Imagine instead:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# Pull your snippets down as files&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;snippet&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;pull&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# Edit them locally, in your editor, with Git tracking changes&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;git&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;add&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;snippets/my-function.php&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;git&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;commit&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-m&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;span&gt;fix: correct tax calculation logic&lt;/span&gt;&lt;span&gt;&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# Push back to WordPress&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;lps&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;snippet&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;push&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Your snippet is now version-controlled. You have a diff. You can roll back. You can review the change in a PR. This is how software is supposed to work, and it’s exactly what Loopress brings to WordPress: a CLI that treats your snippets and Composer dependencies as files, plus a plugin that lets you manage PHP dependencies from the admin panel without server access.&lt;/p&gt;
&lt;p&gt;WordPress stays WordPress. Your clients can still use it the way they love. You just work with it like a developer.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The rest of this blog will cover specific workflows in detail: version-controlling Code Snippets with Git, installing Composer packages without SSH, syncing menus and styles between environments, and managing multiple client sites as code. Those posts are coming soon; this one lays the groundwork for why they matter.&lt;/p&gt;
</content:encoded><category>developer experience</category><category>wordpress</category><category>beginners</category></item><item><title>Why I Built Loopress</title><link>https://docs.loopress.dev/blog/why-i-built-loopress/</link><guid isPermaLink="true">https://docs.loopress.dev/blog/why-i-built-loopress/</guid><description>I&apos;m a frontend developer who cares deeply about DX. Then I had to build a WordPress site, and nothing was the same.</description><pubDate>Mon, 08 Jun 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I’m a frontend developer who’s spent the last few years working in environments where everything is versioned, deployments are automated, and “it works on my machine” isn’t an acceptable answer.&lt;/p&gt;
&lt;p&gt;One of the jobs that shaped how I think about this was &lt;strong&gt;Bedrock Streaming&lt;/strong&gt;, a streaming platform where every developer owned their infrastructure, frontend included, and the tool we used was &lt;strong&gt;Terraform&lt;/strong&gt;. I remember something clicking when I started using it: your infra is just a file, which means it gets versioned, reviewed, and rolled back like any other piece of code. That idea stuck with me well past that job.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;a-site-for-my-sister&quot;&gt;A site for my sister&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;My sister runs an online French tutoring business (&lt;a href=&quot;https://nativefrenchteacher.com&quot;&gt;nativefrenchteacher.com&lt;/a&gt;). She’s not technical, and she needed to manage her own content without calling me every time. WordPress made sense.&lt;/p&gt;
&lt;p&gt;And honestly, it worked great for her. Whatever I needed (bookings, SEO, forms, caching) there was a plugin. The ecosystem is massive.&lt;/p&gt;
&lt;p&gt;Building &lt;em&gt;with&lt;/em&gt; it as a developer was another thing entirely.&lt;/p&gt;
&lt;p&gt;I used the Code Snippets plugin constantly. And every time I touched a snippet, the same thought: if something breaks, I have no history. No diff. Just hope it doesn’t break.&lt;/p&gt;
&lt;p&gt;The real moment was when I needed to manipulate PDFs and wanted to pull in a Packagist package. So I SSH’d into the server, installed Composer manually, ran the install, crossed my fingers. It worked. But it felt wrong. This is a solved problem everywhere else.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-gap&quot;&gt;The gap&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;I came from a world where code lives in Git and environments are reproducible. WordPress assumes you click things in the admin, upload files via FTP, and remember what you changed. Production is always slightly different from local.&lt;/p&gt;
&lt;p&gt;That’s not a knock on WordPress. It’s built for a different audience. But the developer building &lt;em&gt;on top&lt;/em&gt; of it is left to figure things out alone.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-i-built&quot;&gt;What I built&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;I started building &lt;strong&gt;Loopress&lt;/strong&gt;: a CLI to version-control code snippets in Git and sync them to any WordPress instance, and a plugin that brings Composer dependency management into the admin panel, no SSH needed.&lt;/p&gt;
&lt;p&gt;The goal was to bring the same idea I took away from Terraform into WordPress: your snippets, your dependencies, your configuration, all of it living in a repo, reviewable, deployable, not scattered across admin panels and SSH sessions you’ll never remember.&lt;/p&gt;
&lt;p&gt;Still building. If any of this sounds familiar, I built it for you.&lt;/p&gt;
&lt;p&gt;→ &lt;a href=&quot;https://docs.loopress.dev/wordpress-plugin/&quot;&gt;Get started with the plugin&lt;/a&gt; or &lt;a href=&quot;https://docs.loopress.dev/cli/&quot;&gt;the CLI&lt;/a&gt;&lt;/p&gt;
</content:encoded><category>developer experience</category><category>wordpress</category><category>story</category></item></channel></rss>