[ad_1]
Hello,
you asked in the right forum.
the_content hook is used to proces page/post content to insert blocks before/after content and before/after paragraphs:
https://adinserter.pro/faq/how-ad-inserter-works#automatic-insertion
You also need to enable right page type(s):
https://adinserter.pro/documentation/wordpress-page-types
https://adinserter.pro/documentation/additional-block-settings#insert
Can you please describe steps and settings to reproduce the issue?
This is my employer’s wordpress installation, so it’s unfortunately not easy for me to reproduce, but here are some more details:
- We have a block configured like so
- It works fine when viewed on our site. You can see it if you scroll down to the blurb about “Experience your Angular Apps…”
- As part of a separate project, we are using WPGraphQL to expose the WordPress REST API as a GraphQL API. Our hope is that when we make an HTTP GraphQL request for the post I linked, the response would also contain the html for “Experience your Angular Apps…” blurb. But that is not currently the case. The content of the post is returned, the the AdInserter block is missing.
- This could be a problem with WPGraphQL, but I wanted to ask here first to confirm that AdInserter supports this use case before opening an issue with them
Please enable remote debugging (tab ⚙ / tab Debugging) and post url to check.
Ok, I have enabled remote debugging. Here is an example with the blocks labeled.
I’m not sure how this helps though, like I said before the blocks are correctly displayed on the site.
Not sure what to check, all the blocks seem to be inserted according to the settings.
Perhaps you mis-understood. Yes, AdInserter works correctly on our wordpress site
My question is:
Is AdInserter expected to work when another installed non-theme plugin (WPGraphQL in my case) makes a call to apply_filters( 'the_content', $content )?
Well, I would need to check it where it doesn’t work.
You need to use the filtered content, try this:$content = apply_filters ('the_content', $content);
I don’t control the code in question. I’m just trying to figure out if WPGraphQL is compatible with what AdInserter does for automatic insertion before/after paragraphs.
However, it sounds like you are saying that as long as any plugin is calling apply_filters ('the_content', $content) and using the result, AdInserter should do Automatic Insertion on the content.
If that’s the case, I think I’ll consider my question answered!
Correct.
In case it doesn’t work as expected I would need to check it on the page (url) where it doesn’t work.
