• Hello all,

    Just for the record, I’ve tried everything to my level of knowledge in this matter to fix this problem without success ??

    My photoblog (https://blogwithphotos.net) is based on a custom theme (I customized it) based on the PB3-LT (Photo-Biyori Light) theme (today outdated). After the last WP (4.5) update the textarea just started to appear when I want to add a new post.

    Disabled all the plugins, the textarea was still not there. Changed the theme (all pluging enabled / disabled) the textarea did appear.

    OK, so it’s the theme’s fault. Unfortunately the author does not offer support anymore.

    I’ve check the web server logs and came over this error generated when I click Add New Post:

    2016/07/03 14:02:35 [error] 15617#0: *412754 FastCGI sent in stderr: “PHP message: WordPress database error Column ‘post_excerpt’ cannot be null for query INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES (1, ‘2016-07-03 21:02:35’, ‘0000-00-00 00:00:00’, ”, ”, ‘Auto Draft’, NULL, ‘auto-draft’, ‘post’, ‘open’, ‘open’, ”, ”, ”, ”, ‘2016-07-03 21:02:35’, ‘0000-00-00 00:00:00’, 0, 0, ”, ”) made by get_default_post_to_edit, wp_insert_post
    PHP message: PHP Warning: Creating default object from empty value in /xxx/xxxxx/xxxxxx/wp-admin/includes/post.php on line 639″ while reading response header from upstream, client: x.x.x.x, server: blogwithphotos.net, request: “GET /wp-admin/post-new.php HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php5-fpm.sock:”, host: “blogwithphotos.net”, referrer: “https://blogwithphotos.net/wp-admin/themes.php”

    The message is pretty explanatory, that the ‘post_excerpt’ cannot have NULL value.

    Do you have an idea where to look for code that is generating this problem? If you can point me to the right direction, I may be able to do the rest on my own.

    I’ve tried to change the theme to something that works, unfortunately I wasn’t able to find a theme that resemble this one, in which the focus to be on the photography and not other elements. If you have an idea in this direction is also welcome.

    Thanks a lot!

Viewing 1 replies (of 1 total)
  • Thread Starter yotis

    (@yotis)

    I found the code that is causing the source, now I just need to check how to fix it.

    In the functions.php I have the following:

    // ===== PB AUTO-INSERT EXCERPT ===== //
    function pb_insert_excerpt(){
            $post_data = &$_POST;
            $post_id = $post_data['ID'] ;
            $post_title = $post_data['post_title'];
            $post_excerpt = $post_data['post_excerpt'];
            $existing_img = strstr($post_excerpt, 'jpg');
            if($post_data['post_excerpt'] = isset($post_data['excerpt'])) {
                            if ($existing_img) {
                                    return $post_excerpt;
                    } else {
                                    $arrImages =& get_children('post_type=attachment&post_mime_type=image&post_parent=' . $post_id);
                                    if($arrImages) {
                                            $arrKeys = array_keys($arrImages);
                                            $iNum = $arrKeys[0];
                                            $sThumbUrl = wp_get_attachment_thumb_url($iNum);
                                            $thumbWidth = get_option("thumbnail_size_w");
                                            $thumbHeight = get_option("thumbnail_size_h");
                                            $sImgString = '<img src="' . $sThumbUrl . '" width="'.$thumbWidth.'" height="'.$thumbHeight.'" alt="'.$post_title title="'.$post_title.'" />' ;
                                            return $sImgString;
                                    }
                            }
            }
    }

    Then later this function is called and the original excerpt is removed:

    add_filter('excerpt_save_pre', 'pb_insert_excerpt');
    remove_filter('the_excerpt', 'wpautop');

    If I comment the pb_insert_excerpt
    //add_filter('excerpt_save_pre', 'pb_insert_excerpt');

    all is fine, the textarea appears.

    Now I just have to check what in this function is breaking the functionality. If you have any idea to speed up things, I would appreciate it.

    I just assume that there is something regarding how this function is written and the new code of WP 4.5

    Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘Add new post -> Textarea does not appear…’ is closed to new replies.