-1

I have an issue with my custom WP plugin. But I newbie in WP, so I need your help. I have an app and a WP site. My app sends some requests to custom endpoints on the WP site side. WP side process request and do some work and call some function for example. That function creates a string with the script, which I should inject into WP site header. I try using wp_head action hook but always I get the same result: 'Cannot modify header information - headers already sent by'

If it's possible to modify WP site headers in this way? Maybe you know how to figure out this issue?

Sergiy
  • 34
  • 6

1 Answers1

0

Use ob_start to output buffering:

<?php
ob_start();

// code 

ob_end_flush();
?> 
Diksha
  • 137
  • 2
  • 3
  • 9