What I want to achieve
I want to add a custom oembed provider to my wordpress site. The custom oembed provider is my own web app.
What I have implemented
I have added the following code to the functions.php file of my theme, following the official documentation and examples found online :
function custom_oembed_provider() {
error_log("UPDATING PROVERS LIST FAILS HERE FOR SOME REASON");
wp_oembed_add_provider('(https?:\/\/)?((www)\.)?myip:5000\/figure\/.*', 'http://myip:5000/services/oembed',true);
}
add_action( 'init', 'custom_oembed_provider' );
The symptom I see
When I try to embed a content matching the URL pattern, I get the following error in return:
{
"code": "oembed_invalid_url",
"message": "Not Found",
"data": {
"status": 404
}
}
The cause I have found
According the source code I have looked up, it comes from the fact that my url does not match any known provider.
And indeed, I checked thanks to the great wp-cli tool, and the list of know providers only contains the default wordpress whitelisted oembed providers described in the docs, as you can see on this screenshot:
result from list providers command
However, I know that the wp_omebed_add_provider has been called, it logs the "updating providers" message.
What I have tried
Some of the things I have tried with no success:
Any idea how I could solve this? It is an important feature of the website I am building :( Thanks !
PS : I run PHP 7.3 and Wordpress 5.7.2 on a managed OVH Web public cloud.
I have solved it, 3 things were overlapping hence the confusion: