Wordpress plugin AJAX links replacement doesn't work
Hi, I'm making news site: propernewsfeed.com and want to use cloudinary, but the problem is that the cloudinary wordpress plugin does not replace links in the content itself, but replaces them on the fly. It stores the original URL for some reason and only upon request changes it to a cloudinary URL:
Because my content is loaded via AJAX requests and raw content is taken.
And here is the code of live AJAX content loading:
...
return get_post(YOUR_WP_POST_ID)->post_content;
...
You can click on the "Show more" buttons and see through the inspector that there is a wrong URL in the pictures.
Actually, this is the problem.
-
Hi Alexander,
Instead of your code above, would you mind trying this one:
$cloudinary = Cloudinary\get_plugin_
instance();
$replace = new Cloudinary\String_Replace( $cloudinary );
$post_id = SOME_LOGIC;
return $replace->replace_strings( apply_filters( 'the_content', get_post( $post_id )->post_content ) );Thanks for letting me know if that works.
Best,
Loic
1 -
Hi Alexander,
Thanks for reaching out.
This is indeed not supported with the new delivery system introduced in v3 but we will open this in a future version (probably the next one). If you need urgently this, I would recommend downgrading to the 2.7.7 version that you can download here.
Thanks for your understanding.
Best,
Loic
0
Post is closed for comments.
Comments
2 comments