WordPress Ajax always returns a 404 error

This was very frustrating to figure out. I spent hours on this issue and discovered your problem is in this input: <input type=”text” name=”name” id=”name” size=”30″ value=””/> Try changing the input field name to anything but “name”, for example: <input type=”text” name=”user_name” id=”name” size=”30″ value=””/>

ajax live search for post title

Here is a working solution (tested as is) The HTML (could be part of page content) <input type=”text” name=”keyword” id=”keyword” onkeyup=”fetch()”></input> <div id=”datafetch”>Search results will appear here</div> The JavaScript ( goes to your theme’s functions.php ) // add the ajax fetch js add_action( ‘wp_footer’, ‘ajax_fetch’ ); function ajax_fetch() { ?> <script type=”text/javascript”> function fetch(){ jQuery.ajax({ … Read more

Stray closing paragraph tag when using shortcodes

This is frustrating issue as I can’t depend on the content editors to be savvy enough with WordPress / HTML to understand how the text they input will be parsed… –EDIT– Having thought of this a bit more I have reconsidered my earlier answer. HTML5+ comes with the Tidy extension, if you are able to … Read more

Allowing more elements in comments via functions.php

Here is an example how to allow a commenter to insert HTML5 video into the comment. Both <video> and <source> elements has two allowed attributes. preprocess_comment filter is applied when saving the comment to the DB. See /wp-includes/kses.php for $allowedtags array structure. function myAllowHtmlComments($comment) { global $allowedtags; $allowedtags[‘video’] = array( ‘width’ => true, ‘height’ => … Read more

Cite-Tag for blockquotes

The TinyMCE Custom Styles Codex Page should get you through this. There are code snippets on that page, but, as an overview, the process requires two steps: Add the TinyMCE “styleselect” element to the first or second row of icons. Add one or more elements to that styleselect menu. If this were me, I would … Read more

inside a metabox

It’s not the right approach, since you are in a post(cpt) edit page the metabox’s are simple grouped fields that get attached to the post form and in your case it’s actually the browser who is filtering your metabox’s form attributes and not WordPress since you are creating nested forms which is something that you … Read more