Transient and buffer problem

I’m experiencing two problems on my site.

  1. I my trying to add output buffering in my form, but when i use ob_start(), i lose everything on my site.
  2. I also want to show a message like “please enter a valid URL” when i don’t enter any URL in the fields.

My code:

Plugin Name:  Terms and Conditions
Version: 1.0
Description: Adds required "i agree to terms and conditions" checkbox at the end of registration forms

// Call Terms_and_conditions_menu is function which load plugin menu
add_action( 'admin_menu', 'terms_and_conditions_submenu', 20 );

// Add to WordPress admin menu
if( !function_exists("terms_and_conditions_submenu") ) {
    function terms_and_conditions_submenu(){

add_submenu_page( 'wpjb-config','WordPress Extra Post Info', __('Terms And Conditions'),'manage_options', 'terms-post-info','terms_post_info_page');

        // update_terms_condition_info update database
        add_action( 'admin_init', 'update_terms_condition_info' );

// This function register on database
if( !function_exists("update_terms_condition_info") ) {
    function update_terms_condition_info() {
        register_setting( 'terms-conditions-info-settings', 'terms_post_info' );

// Page our plugin
if( !function_exists("terms_post_info_page") ) {

    function terms_post_info_page() {

    esc_html( '<h1>Terms And Condition</h1>','<td><input type="text" name="terms_post_info" value="<?php echo get_option(terms_post_info); ?>"/></td>', ' <th scope="row">Terms and condition link:</th>')

           <div class="wrap">
            <h1>Terms And Condition</h1>

              <form method="post" action="options.php">
                <?php _e(settings_fields( 'terms-conditions-info-settings' )); ?>
                <?php _e(do_settings_sections ('terms-conditions-info-settings' )); ?>
                    <table class="form-table">
                        <tr valign="top">
                            <th scope="row">Terms and condition link:</th>
                            <td><input type="url" name="terms_post_info" value="<?php echo get_option('terms_post_info'); ?>"/></td>
                <?php submit_button(); ?>

add_filter("wpjb_form_init_company", "mod_wpjb_tos_field");
add_filter("wpjr_form_init_register", "mod_wpjb_tos_field");

function mod_wpjb_tos_field($form) {

    if(is_admin() || $form instanceof Daq_Form_ObjectAbstract && !$form->isNew()) {
        return $form;

    // change terms-and-conditions to your ToS page slug,
    // or create a Page with slug terms-and-conditions
    $page = get_page_by_path("terms-and-conditions");

    if($page) {
        $url = get_permalink($page->ID);
    } else {
        $url = get_option('terms_post_info');

    $form->addGroup("tos", "Terms and Conditions");

    $e = $form->create("uterms", "checkbox");
    $e->setLabel(__("Terms And Conditions", "wpjobboard"));
    $e->addOption(1, 1, "I have read and agree to the <a href="$url">Terms and Conditions</a>.");
    $e->addFilter(new Daq_Filter_Int());
    $form->addElement($e, "tos");

    return $form;


How can i do that?

Read more here: Transient and buffer problem

Leave a Reply

Your email address will not be published. Required fields are marked *