WordPress.org

Ready to get started?Download WordPress

Forums

Limit the Post Size (Not just the Excerpt size) (5 posts)

  1. NathanielElliott
    Member
    Posted 1 year ago #

    My goal is to simply limit the post size on the admin side of the post. I want to limit the entire system to only allow posts that are 300 characters throughout the site. Any ideas on how to do this?

  2. NathanielElliott
    Member
    Posted 1 year ago #

    I am not looking to limit the excerpt size but the post size itself. Trying to figure this out! Thanks for any help / direction!

  3. NathanielElliott
    Member
    Posted 1 year ago #

    So, here is my starting point that I've found thus far, now trying to add the same functionality to the "post" area:

    wp-admin/edit-form-advanced.php

    <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off"
                   onKeyDown= "limitText(this.form.post_title,this.form.countdown,20);"
                   onKeyUp="limitText(this.form.post_title,this.form.countdown,20);"
    />

    wp-admin/js/word-count.js

    function limitText(limitField, limitCount, limitNum) {
    	if (limitField.value.length > limitNum) {
    		limitField.value = limitField.value.substring(0, limitNum);
    	} else {
    		limitCount.value = limitNum - limitField.value.length;
    	}
    }

    Originally from This Great Article!

  4. NathanielElliott
    Member
    Posted 1 year ago #

    I saw that you could do this, would this help?

    ALTER TABLE wp_posts CHANGE post_title post_title VARCHAR( 80 ) NOT NULL

  5. NathanielElliott
    Member
    Posted 1 year ago #

    Moved To: HERE

Topic Closed

This topic has been closed to new replies.

About this Topic