Could not insert post into the database

It was actually funny when it happened to me. I just can’t seem to find the way to insert post in WordPress via coding. I looked into Google, here and there, support forums, you know all the desperations.

Not knowing anything about it, I then went to see the log(debug.log) file of WordPress and found this:

register_post_type was called <strong>incorrectly</strong>. Post type names must be between 1 and 20 characters in length. Please see <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 4.2.0.) in /app/public/wp-includes/functions.php on line 5167

Well folks, the answer was right there, the post_type name should not exceed 20 chars in length 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *