Support » Plugin: Auto Generate Title » Updated Version to replace Sensitive Characters

  • I am using it on my blog

    However, whenever there was a special character in the beginning of the text I got a blank post due to special characters.

    Modified the code to replace the post data and remove special characters. Using it with the current latest version of WordPress.

    Ideally a new version is created so everyone can benefit.

    Plugin Name: Auto Generate Title
    Author: Jatinder Pal Singh,
    Version: 1.2
    Tags: post title, title, automatic, generator
    Requires at least: 3.0.1
    Tested up to: 5.4.2
    Stable tag: 1.1
    License: GPLv2 or later
    License URI:
    Description: Auto Generate Title from the POST Content. If you leave Title blank, it will use the text written in [agt][/agt] within your post content. If you do not mention these shortcodes in your post, It will pick up first 30 characters from the post.

    1) $postdata2 = preg_replace(“/[^A-Za-z0-9 ]/”, ”, $postdata);
    2) $data[‘post_title’] = substr($postdata2,0,30);


    add_shortcode(“agt”, “agt_shortcode”);
    function agt_shortcode( $atts, $content = null ) {
    return $content;

    add_filter( ‘wp_insert_post_data’ , ‘auto_generate_title’ , ’99’, 2 );
    function auto_generate_title( $data , $postarr )

    $title_of_post = ltrim($data[‘post_title’]);
    $length_of_title = strlen($title_of_post);
    $postdata = ltrim($data[‘post_content’]);
    $postdata2 = preg_replace(“/[^A-Za-z0-9 ]/”, ”, $postdata);
    $matchPattern = “/\[agt\](.*?)\[\/agt\]/”;
    preg_match_all($matchPattern, $postdata, $foundIt, PREG_PATTERN_ORDER);
    if (isset($foundIt[1][0]))
    $data[‘post_title’] = $foundIt[1][0];
    $data[‘post_title’] = substr($postdata2,0,30);
    return $data;

  • The topic ‘Updated Version to replace Sensitive Characters’ is closed to new replies.