false ), $atts) ); if ( !$id ) return ''; $snippet = get_option('rhs_snippet-' . $id); return $snippet; } add_action('admin_menu', 'rhs_raw_html_snippet_admin_menu'); function rhs_raw_html_snippet_admin_menu() { add_submenu_page('options-general.php', 'Raw HTML Snippets', 'Raw HTML Snippets', 'edit_posts', 'raw-html-snippets', 'rhs_raw_html_snippet_settings'); } function rhs_raw_html_snippet_settings() { if ( $_GET['edit'] ) return rhs_raw_html_snippet_editor(); if ( $_GET['add'] ) return rhs_raw_html_snippet_add(); $errors = array(); $clean = array(); if ( $_GET['rhs_del'] && wp_verify_nonce($_GET['rhs_nonce'], 'rhs_delete') ) { delete_option('rhs_snippet-' . $_GET['rhs_del']); $snippet_list = get_option('rhs_snippet_list'); if ( is_array($snippet_list) && in_array($_GET['rhs_del'], $snippet_list) ) { $snippet_list = array_diff( $snippet_list, array( $_GET['rhs_del'] ) ); update_option('rhs_snippet_list', $snippet_list); $success = 'Snippet with ID "' . esc_html($_GET['rhs_del']) . '" successfully deleted.'; } } $snippet_list = get_option('rhs_snippet_list'); if ( !is_array($snippet_list) ) $snippet_list = array(); ?>

Manage Raw HTML Snippets

Create and manage your HTML snippets here. Name them with an id (letters, numbers, and dashes only) and then call them within your content via shortcode:
[raw_html_snippet id="my-unique-id"]

This will use maintain core WordPress content filtering and autoformatting for all other elements within your content while allowing you to easily insert managed RAW HTML.

WARNGING: This does not filter your HTML for errors or for malicious scripts. Use at your own risk.

0 ) : ?>

Your Snippet Library

Snippet Name Shortcode Actions
[raw_html_snippet id=""] Edit Snippet | Delete Snippet

Your Snippets Library is Empty

You have no snippets, please please add one.

$snippet ); ?>

Edit Raw HTML Snippet: ""

« Back to main page

0 ) : ?>

$v ) $clean[$k] = stripslashes($v); if ( empty($clean['snippet_id']) ) $errors[] = 'Please enter a unique snippet ID.'; elseif ( in_array(strtolower($clean['snippet_id']), $snippet_list) ) $errors[] = 'You have entered a snippet ID that already exists. IDs are NOT case-sensitive.'; if ( empty($clean['snippet_code']) ) $errors[] = 'Enter some HTML for this snippet.'; if ( count($errors) <= 0 ) { // save snippet $snippet_id = strtolower($clean['snippet_id']); $snippet_list[] = $snippet_id; update_option('rhs_snippet_list', $snippet_list); update_option('rhs_snippet-' . $snippet_id, $clean['snippet_code']); $success = 'Your snippet has been saved.'; $clean = array(); } } ?>

Add Raw HTML Snippet:

« Back to main page

0 ) : ?>