Plugin Contributor
Maya
(@tdgu)
Hi,
The wp-hide/ob_start_callback returns the whole buffer, meaning the html page which will be outputted to the browser. I presume you need to replace some texts within? Try to add better description to your text replacements e.g.
class="woocommerce instead just woocommerce which is too general and can e found including within urls.
Thanks
-
This reply was modified 7 years, 9 months ago by
Maya.
Thank you for the reply. Yes, I want to change texts that still shows the names of plugings and theme from the functions file as you recommend in your post.
With your recommendtion I got http 500 error in my admin dashboard trying this:
add_filter( ‘wph/ob_start_callback’, ‘custom_ob_start_callback’ );
function custom_ob_start_callback( $buffer )
{
$buffer = str_replace(class=”woocommerce” , “testwoo”, $buffer);
return $buffer;
}
I tryed again without “class=”, just the word “woocommerce”, and now it seems nothing happening. I tryed with other words but the same, I clear Cache and I save Rewrite and nothing changes in my html (minimified html & css).
Once getting it working, if I want to make it for more text, I have to place the same code structure as many text rplacments?
I would be grateful if you can help me with this,
Thanks in advance
Plugin Contributor
Maya
(@tdgu)
Your code contain errors:
$buffer = str_replace(class=”woocommerce” , “testwoo”, $buffer);
change it to
$buffer = str_replace('class=”woocommerce”' , “testwoo”, $buffer);
This is the correct filter and is really straightforward to be used. However the above replacement is not logically correct and might produce a layout break for a specific area.
Or consider the visual text replacement included within PRO https://www.wp-hide.com/replace-arbitrary-words-from-page-html-through-a-visual-interface-module/
Thank you! It worked fine. In the second try I toke the wrong filter (there are two different posts with a partial difference in filters, wp-hide and wph).
Well, using class the output result is just partial. The result I’m looking for is putting the general word in order to change it in all the output including urls, but without breaking functionnalities and layout. Do you think there is another solution to do this?
If not, do you have plans to add an option to obfuscate or hash the output html for specific words in general?
Thank you