Title: Undefined variable: new_content
Last modified: February 28, 2018

---

# Undefined variable: new_content

 *  Resolved [juanshaf](https://wordpress.org/support/users/juanshaf/)
 * (@juanshaf)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-new_content/)
 * Hi again,
 * I’m receiving another error in the current release.
 * Notice: Undefined variable: new_content in public_html/wp-content/plugins/apply-
   online/public/class-applyonline-public.php on line 287
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fundefined-variable-new_content%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Farhan Noor](https://wordpress.org/support/users/farhannoor/)
 * (@farhannoor)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-new_content/#post-10025755)
 * Hi,
    It seems that some modification were made to this plugin. Remove & reinstall
   this plugin to get it back to original state.
 * Regards
 *  Thread Starter [juanshaf](https://wordpress.org/support/users/juanshaf/)
 * (@juanshaf)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-new_content/#post-10026205)
 * I tried your suggestion and deactivated and deleted the plugin. I reinstalled
   the plugin via the Plugins->Add New, and the problem continues to exist.
 * I should point out that I’m using custom single-aol_ad.php and archive-aol_ad.
   php templates.
 * Changing this:
 *     ```
       //Show this content if you are viewing aol_ad post type using single.php (not with single-aold_ad.php)
                   if(is_singular() and 'single-aol_ad.php' != wp_basename($template)):
                       $new_content = '<div class="aol-single-ad">'.$content.$title_features.$features.$title_form.$form.'</div>';
                   endif;
                   return apply_filters( 'aol_content', $content, $features, $form );
       ```
   
 * To This:
 *     ```
       //Show this content if you are viewing aol_ad post type using single.php (not with single-aold_ad.php)
                   if(is_singular() and 'single-aol_ad.php' != wp_basename($template)):
                       $new_content = '<div class="aol-single-ad">'.$content.$title_features.$features.$title_form.$form.'</div>';
       				return apply_filters( 'aol_content', $new_content, $content, $features, $form );
                   endif;
                   return apply_filters( 'aol_content', $content, $features, $form );
       ```
   
 * At the bottom of class-applyonline-public.php fixed my issue as `$new_content`
   is undefined for me due to the `wp_basename($template)` condition.
 *  Plugin Author [Farhan Noor](https://wordpress.org/support/users/farhannoor/)
 * (@farhannoor)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-new_content/#post-10026609)
 * instead of all this, you should use function **echo aol_form();** within wordpress
   loop on your sing-aol_ad.php. Also look at documenation here [http://wpreloaded.com/plugins/apply-online/reference/](http://wpreloaded.com/plugins/apply-online/reference/)
    -  This reply was modified 8 years, 2 months ago by [Farhan Noor](https://wordpress.org/support/users/farhannoor/).
 *  Thread Starter [juanshaf](https://wordpress.org/support/users/juanshaf/)
 * (@juanshaf)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-new_content/#post-10027297)
 * I am already using echo aol_features() and echo aol_form() in my single-aol_ad.
   php, that’s not the problem. I already read the documentation 🙂
 * The code I posted previously is an issue with the if statement in your plugin
   code, not my single-aol_ad.php.
 * If you inspect the code at line 287 in apply-online/public/class-applyonline-
   public.php you’ll see the if statement above this line is where $new_content 
   is defined, only if the template is not single-aol_ad.php.
 * Then the apply_filter call outside the if enclosure is attempting to use the 
   variable while the conditions were not met, therefore it is undefined when a 
   single-aol_ad.php template is used.
 * All you need to do is replace the code at the bottom of apply-online/public/class-
   applyonline-public.php with the fix I provided above. If you look at line 287
   and the if statement above the line, you’ll see what I mean.
 * Thanks.
 *  Plugin Author [Farhan Noor](https://wordpress.org/support/users/farhannoor/)
 * (@farhannoor)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-new_content/#post-10028782)
 * Ok, I got it. The best solution is to initiate $new_content before the if condition
   i.e. $new_content = NULL;
 * Thank you for reporting this bug. I appreciate your effort to reach the solution.
   It will be fixed in next plugin update.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Undefined variable: new_content’ is closed to new replies.

 * ![](https://ps.w.org/apply-online/assets/icon-256x256.jpg?rev=1539935)
 * [ApplyOnline - Application Form Builder and Manager](https://wordpress.org/plugins/apply-online/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/apply-online/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/apply-online/)
 * [Active Topics](https://wordpress.org/support/plugin/apply-online/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/apply-online/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/apply-online/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Farhan Noor](https://wordpress.org/support/users/farhannoor/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-new_content/#post-10028782)
 * Status: resolved