Title: Sudden Critical php error
Last modified: June 26, 2024

---

# Sudden Critical php error

 *  [wpidl](https://wordpress.org/support/users/wpidl/)
 * (@wpidl)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/sudden-critical-php-error/)
 * Something happened and suddenly I can no longer paste php codes into my functions.
   php of my wordpress theme.
 * I say sudden because I used to add tons of code and now I get critical error 
   every time I try to save a php code. I do not know when or why or how to test
   where the problem lies.
   What I did so far: Deleted all added php code from functions.
   php to start blank.I did try to change theme (currently am using elementor’s 
   child theme hello).Deactivated all plugins.
 * WordPress – Version 6.5.4
   Woocommerce – Version 8.8.5

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

 *  [George Appiah](https://wordpress.org/support/users/gappiah/)
 * (@gappiah)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/sudden-critical-php-error/#post-17852724)
 * > I say sudden because I used to add tons of code and now I get critical error
   > every time I try to save a php code. I do not know when or why or how to test
   > where the problem lies.
 * That’s likely because you either have an error in the new code… or where you’re
   placing the code is introducing the error.
 * > What I did so far: Deleted all added php code from functions.php to start blank.
 * Can you share the full code in the `functions.php` file that’s throwing the error?
   Use the **Code block**, or [PasteBin](https://pastebin.com/) if it’s a lot of
   code.
 *  Thread Starter [wpidl](https://wordpress.org/support/users/wpidl/)
 * (@wpidl)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/sudden-critical-php-error/#post-17853379)
 * I’m pasting all of it here, but the problem is that it worked before and suddenly
   it’s all php error, when i try to add new or re-add after I cleaned it all to
   test.
 *     ```wp-block-code
       // Allow SVGadd_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {  global $wp_version;  if ( $wp_version !== '4.7.1' ) {     return $data;  }  $filetype = wp_check_filetype( $filename, $mimes );  return [      'ext'             => $filetype['ext'],      'type'            => $filetype['type'],      'proper_filename' => $data['proper_filename']  ];}, 10, 4 );function cc_mime_types( $mimes ){  $mimes['svg'] = 'image/svg+xml';  return $mimes;}add_filter( 'upload_mimes', 'cc_mime_types' );function fix_svg() {  echo '<style type="text/css">        .attachment-266x266, .thumbnail img {             width: 100% !important;             height: auto !important;        }        </style>';}add_action( 'admin_head', 'fix_svg' );add_filter( 'pms_member_account_tabs', 'pmsc_change_member_account_tabs', 20, 2 );function pmsc_change_member_account_tabs( $tabs, $args ) {    $tabs['obqvi'] = __( 'Обяви', 'paid-member-subscriptions' );    $tabs['poruchki'] = __( 'Поръчки', 'paid-member-subscriptions' );    return $tabs;} add_filter( 'pms_account_shortcode_content', 'pmsc_custom_tab_content', 20, 2 );function pmsc_custom_tab_content( $output, $active_tab ) {    if ( $active_tab == 'obqvi' ) {        $output .= '<h3 class="grids-h">Вашите обяви</h3><a class="grids-a" href="https://prodan.bg/%d1%81%d0%b2%d0%be%d0%b1%d0%be%d0%b4%d0%bd%d0%b0-%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d0%bd/#syzdajobqva">Създайте обява</a>';        $output .= '[wpv-view name="ac-template" ids="6554"]';    } if ( $active_tab == 'poruchki' ) {        $output .= '<h3 class="grids-h">Вашите поръчки</h3>';     $output .= '<div class="row-2">  <div class="column-2">Поръчка №</div>  <div class="column-2">Дата</div>  <div class="column-2">Име</div>  <div class="column-2">Общо в лв.</div>                   </div>';        $output .= '[wpv-view name="orders" ids="7980"]';    }    return $output;}/** * Filter the upload size limit for non-administrators. * @param string $size Upload size limit (in bytes). * @return int (maybe) Filtered size limit. */function filter_site_upload_size_limit( $size ) {    // Set the upload size limit to 1 MB for users lacking the 'manage_options' capability.    if ( ! current_user_can( 'manage_options' ) ) {        // 1 MB.        $size = 1024 * 5000;    }    return $size;}add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 20 ); //For limiting file typeadd_filter('upload_mimes','restict_mime'); function restict_mime($mimes) {    $mimes = array(                'jpg|jpeg|jpe' => 'image/jpeg',                'gif' => 'image/gif',                'png' => 'image/png',    );    return $mimes;}
       ```
   

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

The topic ‘Sudden Critical php error’ is closed to new replies.

## Tags

 * [critical error](https://wordpress.org/support/topic-tag/critical-error/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [wpidl](https://wordpress.org/support/users/wpidl/)
 * Last activity: [1 year, 11 months ago](https://wordpress.org/support/topic/sudden-critical-php-error/#post-17853379)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
