I'm learning how to build a WordPress plugin. In the sample plugin code, I have this PHP/HTML:
ob_start();
// other plugin code
<?php function plugin_rvce_options_page() { ?>
<div>
<form action="options.php" method="post">
<?php settings_fields('plugin_options'); ?>
<?php do_settings_sections('plugin'); ?>
<input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />
</form>
</div>
<?php } ?>
Initially, this was causing the warning "Headers already sent" before I found ob_start. After implementing ob_start I don't get the warnings.. but am I using it correctly by just adding ob_start at the top of my plugin file?
ob_start
call isn't inside PHP and it's being sent directly to the browser in your above code