ARTICLE AD BOX
WordPress internally translates /wp-json/... into a query var called rest_route. You can add your own rewrite rule that does the same mapping from your custom path. In your theme's functions.php or a custom plugin:
php
add_action('init', function () { add_rewrite_rule( '^api/log/?$', 'index.php?rest_route=/api/log', 'top' // 'top' ensures this rule is evaluated before others ); });After adding this, flush your rewrite rules by going to Settings → Permalinks and clicking Save Changes (no need to change anything, just re-save). This writes the new rule into the internal rewrite table.
Why this works: When WordPress sees /wp-json/api/log, it internally rewrites it to index.php?rest_route=/api/log and hands it off to the REST API dispatcher. This rule does the exact same thing, just from a different URL. The POST body, headers, and method all flow through normally because it's an internal rewrite handled entirely within PHP/WordPress — no HTTP redirect occurs.
Hope this solves your issue.
Explore related questions
See similar questions with these tags.
