Custom rewrite rule serves content, but returns 404 error code

This has been an issue in core for a while, http://core.trac.wordpress.org/ticket/10722. The simplest solution is to just overwrite the headers on ‘template_redirect’. You can replace them as long as you haven’t started any output yet, which you shouldn’t have at this point. Just call status_header( 200 ); No cache headers are also sent when the … Read more

WordPress plugin options and jQuery

Variable can be passed to jQuery or any javascript using wp_localize_script. Example: add_action( ‘template_redirect’, ‘prefix_enqueue_vars’ ); function prefix_enqueue_vars() { $script_vars = array( ‘setting_1’ => get_option( ‘some_option’ ), ‘setting_2’ => get_option( ‘another_option’ ), ); wp_enqueue_script( ‘my_script’, ‘path/to/script.js’, array( ‘jquery’ ), true); wp_localize_script( ‘my_script’, ‘unique_name’, $script_vars ); } How to get the variables in your javascript: jQuery(document).ready(function($) … Read more

Workflow and best practice for documentation [closed]

Great question. There is no generic and comprehensive documentation workflow in WordPress circles. However there are some nice tools and options to make use of. readme.txt Markdown-based machine-readable file. It’s main purpose is to be parsed and presented by official plugin repository, but it’s not too convenient outside of that. It is great and fitting … Read more