Plugin Directory

Code Snippets

An easy, clean and simple way to add code snippets to your site.


  • Removed nested functions
  • Added icons for admin and front-end snippets to manage table
  • Improved settings retrieval by caching settings
  • Updated Russian translation by Alexey Chumakov
  • Added filter switch to prevent a snippet from executing (#25)
  • Fixed errors in string translation
  • Fixed bug in import process (#32)


  • Fixed broken call to export_snippet() function
  • Added support for importing and exporting snippet scope
  • Fixed duplicate primary key database error
  • Improved database table structure


  • Polyfilled array_replace_recursive() function for PHP 5.2
  • Updated references to old plugin site
  • Resolved JavaScript error on edit snippet pages
  • Made minor updates to French translation file
  • Added statuses for snippet scopes on manage snippets table


  • Fixed the default values of new setting not being applied
  • Fixed missing background of tags input


  • Introduced CodeSniffer testing on code
  • Fixed description heading disappearing when media buttons enabled
  • Added snippet scope selector
  • Minified all CSS and JS in plugin
  • Made CodeMirror theme names more readable
  • Fixed bug causing translations to not be loaded


  • Added additional setting descriptions
  • Added settings for code and description editor height
  • Updated CodeMirror to version 5.2
  • Fixed not escaping the request URL when using query arg functions
  • Improved efficiency of settings component



  • Fix error in table creation code
  • Remove settings database option when plugin is uninstalled


  • Fix table creation code not running on upgrade
  • Fix snippets per page option not saving



  • Better import/export functionality
  • New settings page with code editor settings
  • Code rewritten for cleaner and more efficient code
  • Lots of new translations


  • Added link to Code Snippets importer under Snippets admin menu
  • Added settings component and admin page
  • Added support for different CodeMirror themes
  • Integrated tags component into main plugin. Current users of the Code Snippets Tags plugin can safely uninstall it.
  • Added Auto Close Brackets CodeMirror addon (props to TronicLabs)
  • Added Serbo-Croatian translation by Borisa Djuraskovic from Web Hosting Hub
  • Added Highlight Selection Matches CodeMirror addon (props to TronicLabs)
  • Added Chinese translation thanks to Jincheng Shan
  • Added Russian translation by Alexander Samsonov
  • Added Slovak translation by [Ján Fajčák] from WordPress Slovakia
  • Added setting to always save and activate snippets by default


  • Added braces to single-line conditionals in line with new coding standards
  • Split up large classes into separate functions
  • Improved plugin file structure
  • Replaced uninstall hook with single file method
  • Updated CodeMirror library to version 5.0
  • Rewritten import/export functionality to use DOMDocument
  • Merged Code_Snippets_Export_PHP class into Code_Snippets_Export class


  • Removed old admin style support
  • Removed backwards-compatible support


  • Fixed incompatibility errors with PHP 5.2
  • Fixed empty MO translation files
  • Removed duplicate MySQL primary key indexing


  • Add and remove network capabilities as super admins are added and removed
  • Updated MP6 icon implementation
  • Replaced buggy trim <?php and ?> functionality with a much more reliable regex method (#)
  • Added French translation thanks to translator oWEB
  • Fixed snippet failing to save when code contains % character, props to nikan06 (#)
  • Added 'Save & Deactivate' button to the edit snippet page (#)
  • Removed edit and install capabilities (now only uses the manage capability)
  • Fixed HTML breaking in export files (#)
  • Make the title of each snippet on the manage page a clickable link to edit the snippet (#)
  • Added nonce to edit snippet page
  • Hide row actions on manage snippet page by default
  • Removed screenshots from plugin
  • Improved CodeMirror implementation
  • Added a fallback MP6 icon
  • Use the proper WordPress database APIs all of the time
  • Rewritten export functionality
  • Fixed incorrect export filename
  • Updated CodeMirror to version 3.19
  • Removed CodeMirror bundled with plugin
  • Updated WordPress.org plugin banner
  • Fixed CodeMirror incompatibility with the WP Editor plugin
  • Fixed CodeMirror incompatibility with the Debug Bar Console plugin


  • Compiled all CodeMirror scripts into a single file
  • Use Sass + Compass for CSS
  • Use Grunt for build automation
  • Minify CSS
  • Fixed code typo that was breaking export files
  • Updated CodeMirror to 3.15


  • Allow no snippet name or code to be set
  • Prevented an error on fresh multisite installations
  • Refactored code to use best practices
  • Improved database table creation method: on a single-site install, the snippets table will always be created. On a multisite install, the network snippets table will always be created; the site-specific table will always be created for the main site; for sub-sites the snippets table will only be created on a visit to a snippets admin page.
  • Updated to CodeMirror 3.14
  • Changes to action and filter hook API
  • Added error message handling for import snippets page
  • Don't encode HTML entities in database

  • Correct path to admin menu icon (#)

  • Fix a minor bug with custom capabilities and admin menus


  • Fix a bug with snippet being set as deactivated when saved
  • Updated PHP Documentation completely. View online
  • Only load admin functions when viewing dashboard
  • Added German translation thanks to David Decker
  • Allow or deny site administrators access to snippet admin menus. Set your preference in the Enable Administration Menus setting under the Settings > Network Settings network admin menu.
  • Improve database table creation and upgrade process
  • Optimized to use less database queries


  • Improved plugin API
  • Fixed a bug with saving snippets per page option (#)
  • Updated CodeMirror to version 3.11
  • Allow plugin to be activated on individual sites on multisite (#)
  • Slimmed down the description visual editor
  • Added icon for the new MP6 admin UI (#)
  • Strip PHP tags from the beginning and end of a snippet in case someone forgets
  • Changed to MIT license
  • Removed HTML, CSS and JavaScript CodeMirror modes that were messing things up
  • Made everything leaner, faster, and better


  • Fixed a bug with permissions not being applied on install (#)
  • Fixed a bug in the uninstall method (#)


  • Updated code editor to use CodeMirror 3
  • Improved compatibility with Clean Options plugin
  • Code improvements and optimization
  • Changed namespace from cs to code_snippets
  • Move css and js under assets
  • Organized CodeMirror scripts
  • Improved updating process
  • Current line of code editor is now highlighted
  • Highlight matches of selected text in code editor
  • Only create snippet tables when needed
  • Store multisite only options in site options table
  • Fixed compatibility bugs with WordPress 3.5


  • Updated CodeMirror to version 2.33
  • Updated the 'Manage Snippets' page to use the WP_List_Table class
    • Added 'Screen Options' tab to 'Manage Snippets' page
    • Added search capability to 'Manage Snippets' page
    • Added views to easily filter activated, deactivated and recently activated snippets
    • Added ID column to 'Manage Snippets' page
    • Added sortable name and ID column on 'Manage Snippets' page (#)
  • Added custom capabilities
  • Improved API
  • Added 'Export to PHP' feature (#)
  • Lengthened snippet name field to 64 characters (#)
  • Added i18n


  • Added interface to Network Dashboard
  • Updated uninstall to support multisite
  • Replaced EditArea with CodeMirror
  • Small improvements


  • Fixed a bug with version 1.3.1


  • Changed plugin website URI
  • Cleaned up some code


  • Added export option to 'Manage Snippets' page
  • Added 'Import Snippets' page


  • Minor improvements
  • Added code highlighting
  • Removed 'Uninstall Plugin' page
  • Data will now be cleaned up when plugin is deleted through WordPress admin


  • Fixed a permissions bug with DISALLOW_FILE_EDIT being set to true (#)
  • Fixed a bug with the page title reading 'Add New Snippet' on the 'Edit Snippets' page
  • Fixed a bug not allowing the plugin to be Network Activated (#)


  • Stable version released.

Requires: 3.3 or higher
Compatible up to: 4.2.3
Last Updated: 2015-5-20
Active Installs: 10,000+


4.7 out of 5 stars


3 of 10 support threads in the last two months have been resolved.

Got something to say? Need help?


Not enough data

2 people say it works.
0 people say it's broken.

100,1,1 100,1,1
100,2,2 100,2,2
100,1,1 67,3,2 100,1,1 100,3,3 100,3,3 100,6,6 100,1,1
25,4,1 100,1,1 100,2,2
75,4,3 67,3,2 100,1,1
100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,2,2