WPCode – ヘッダーとフッターの挿入 + カスタムコードスニペット – WordPress コードマネージャー


Insert Headers & Footers + Full WordPress Code Snippets Plugin

WPCode (以前の Insert Headers and Footers by WPBeginner) は、100万サイト以上で使用される、最もポピュラーな WordPress コードスニペットプラグインです。

テーマの functions.php ファイルを編集せずに、簡単に WordPress にコードスニペットを追加できるようにします。

Our simple insert headers and footers interface allows you to insert code like Google Analytics, custom CSS, Facebook Pixel, and more to your WordPress site’s header and footer as well other areas of your website. No need to edit your theme files!

Aside from Header and Footer scripts, you can also use WPCode to insert custom PHP code snippets, JavaScript code snippets, CSS code snipets, HTML code snippets, and text snippets with full conditional logic and code priority support.

We took the pain out of adding custom code snippets in WordPress and made it easy.

I have been using Insert Headers and Footers and it is such a useful tool. Super helpful and the very best of its kind. Highly recommend
The_Gibble – WordPress user

WPBeginner による WPCode の概要

Introducing New WPCode Pro
While WPCode Lite offers tons of powerful features for free, we listened to user feedback and created WPCode Pro with even more amazing features to improve your workflow. This includes smart conditional logic, saving code snippets to cloud library, code revisions, page-specific snippets, deeper integration with popular plugins like WooCommerce, Easy Digital Downloads, and so much more. Click here to purchase the best premium WordPress code snippet plugin now!

Future Proof Code Snippet Management

Most WordPress tutorial websites ask you to add code snippets to your theme’s functions.php file. This makes managing code snippets messy, and it also prevents you from updating your theme.

If you ever update your theme or switch to another theme, then you will lose all custom code functions that you added in your functions.php file.

WPCode solves this by providing you an easy way to insert header and footer scripts along with other code snippets directly from your WordPress dashboard. These code snippets actually run as if they were in your theme’s functions.php file.

Our smart code snippet validation helps you prevent common code errors to ensure you never break your website when adding code snippets or header and footer scripts.

You can manage all your header and footer scripts as well as other custom code snippets from a single screen. We even make it easy for you to organize code snippets using Tags and add reminder notes with each code snippet.

New WPCode Cloud Library even allows you to store all your custom code snippets in a cloud library, so you can easily re-use code snippets across multiple website projects and save time. You can keep your code snippets completely private or share it with the community to give back while boosting your social profile.

This plugin allows me to not only add things to my site whenever needed, but it takes me only seconds to accomplish it.
David Weber – WordPress user

Full Code Snippets Library and Code Generators

テスト動作済みの WordPress コードスニペットが、1か所でまとめて探せればいいのにと思ったことはありませんか?

Insert Headers and Footers プラグインを開始したとき、私たちもそうでした。そこで、WPCode プラグイン内に WordPress コードスニペットライブラリを備え付けました。

This makes it easy for you to customize WordPress functions with just a click using expert written code snippets.

REST API の無効化、XML-RPC の無効化、コメントの無効化、SVG ファイルのアップロードの許可、Gutenberg の無効化、Classic Editor の追加など、よくある機能要求に対する検証済みの PHP コードスニペットが見つかります。それぞれに個別のプラグインをインストールする必要はありません。

I was very hesitant to get into any of the code for my website. Your plugin made it easy for me to do.
Conbrio75 – WordPress user

We also built the ability to save your code snippets to WPCode Cloud Library, so you can easily re-use it on your other websites, client projects, or even share it with the larger community.

WPCode Cloud Library helps you better organize your code snippets in one central location, so you can save more time and speed up your workflow when managing websites. No more wasting time looking for custom notes or Github gists.

Aside from our growing code snippets library, we also have WordPress code generators to help you quickly get ready-to-use custom code using the latest WordPress coding standards and API’s.

管理 UI を備えたカスタムコードジェネレーターの例は次のとおりです。

  • Custom Post Type Generator – Create custom code snippet for Post Types.
  • Custom Taxonomy Generator – Get custom code snippet for Taxonomies.
  • WP Query Generator – Get custom code snippet for WP_Query to load posts.
  • Custom Sidebar Generator – Create custom code snippet to register custom sidebars or widget-ready areas.
  • Custom Widget Generator – Custom code snippet to register custom widgets.
  • Navigation Menu Generator – Custom code snippet for registering new navigation menu locations in your theme.

上記に加え、cron ジョブのスケジュール設定、スクリプトの登録、 スタイルシート、カスタム投稿ステータスの追加などのコードスニペットジェネレーターがあります。

Conditional Logic for Code Snippets + Code Insertion Priority

Our goal with WPCode was to create a WordPress code snippets plugin that’s both EASY and POWERFUL.


Instead of learning WordPress conditional logic queries, you can use our beginner-friendly conditional logic user interface to:

  • ログインユーザーに限定したコードスニペット読み込み
  • 特定のユーザー権限のみでの PHP コードスニペット読み込み
  • 特定の固定ページ URL のみでの PHP コードスニペット読み込み
  • 特定のページのヘッダーやフッターへの pixel スクリプト挿入
  • Show code snippets based on type of page
  • 特定の投稿タイプのみでコードスニペットを実行
  • リファラーソースに基づく、ヘッダーとフッターのコードスニペット読み込み
  • などなど…

We also added both automatic code insertion and manual code output using shortcodes.

Our Auto Insert feature allows you to run the code snippet everywhere or choose from custom options like:

  • フロントエンドのみでコードスニペットを実行
  • WordPress 管理エリアのみでコードスニペットを実行
  • サイト全体のヘッダーやフッターへのスクリプト追加
  • 投稿本文の前へのPHPコードスニペットの挿入
  • 特定の段落の後ろへのコードスニペット挿入
  • 特定のアーカイブページへのコードスニペット挿入
  • Insert code snippets after specific WooCommerce function (Pro Feature)

Aside from that, we also added a visual code snippet priority system, so you can choose the order for your custom functions to avoid code conflict.

This is such a useful plugin! It makes it so much easier to include things on your website!
Understoryliving – WordPress user

And for even more flexibility and customization, we have added the ability for you to add page-specific code snippets right from the WordPress classic editor as well as the Gutenberg editor. You can even load code snippets based on device type such as mobile only code snippets, desktop only code snippets, etc.




You can also save your code snippets to WPCode Cloud (Pro feature), so you can easily re-use the same code snippets across multiple websites. This also allows you to better organize your code snippets instead of wasting time searching for random Github gists.


Woody Code Snippets と Code Snippets Pro プラグインの両方からカスタムコードスニペットをインポートする自動インポート機能があります。

Simple plugin I use in quite every site. Very useful to insert scripts and tags.
tommasoperego – WordPress user

Example Use Cases

WPCode is the most powerful code snippet + headers and footers plugin for WordPress. Here are some of the top use-cases why smart website owners and developers love us:

  • ヘッダーおよびフッターへのスクリプト挿入
  • ヘッダーとフッターへの Google Analytics トラッキングコード挿入
  • テーマの functions.php ファイル変更不要の PHP コードスニペットまたは JavaScript コードスニペット挿入
  • 条件付きロジックを使用した、WordPress ヘッダーやフッターへの Facebook Pixels コード、Google コンバージョン Pixels コード、およびその他の広告コンバージョンピクセルスクリプト挿入
  • Insert Google AdSense Ads code, Amazon Native Contextual Ads code, and other Media Ads code
  • カスタム JavaScript, CSS, HTML コードの挿入
  • サイトのヘッダーやフッターに、ソーシャルメディア、Google Search Console、およびその他のドメイン検証用のサイト検証メタタグを挿入
  • Insert re-usable custom content blocks and PHP code snippets
  • 特定の段落の後ろへの広告コードの挿入
  • Show or hide custom code snippets based on conditional logic
  • Disable XML-RPC, Disable Rest API, disable comments, allow SVG file uploads, disable Gutenberg and enable Classic Editor without adding extra plugins.

Simply put, WPCode is the one plugin that helps you get rid of dozens of other plugins without losing functionality.

すべての WPCode の機能一覧

The simple interface of WPCode plugin (formerly known as Insert Headers and Footers) gives you one place where you can insert header and footer scripts as well as custom code snippets rather than dealing with dozens of different plugins.

Below is a full list of WPCode features:

  • セットアップが簡単
  • 無制限のコードスニペット
  • ヘッダーとフッターのスクリプトをグローバルに簡単に挿入
  • PHP、JavaScript、および HTML 用のシンタックスハイライターを備えた初心者向けのコードエディター
  • Smart Code Validation to Prevent PHP Errors
  • 条件付きロジックを使用したヘッダーコードやフッターコードの挿入
  • ヘッダーやフッターへの Google Analytics コード追加
  • カスタム CSS コードをテーマに追加
  • ヘッダーとフッターへの Facebook pixel コード挿入
  • HTML と JavaScript を含む、どんなコードやスクリプトも挿入
  • PHP コードスニペットの挿入
  • Ready-made Code Snippet Library
  • Custom WordPress Code Snippet Generator
  • Show or Hide PHP Code Snippets based on conditional logic
  • Run PHP code and custom code snippets everywhere or in select areas using smart auto-insert rules.
  • Manually insert PHP code snippets using shortcodes anywhere on website
  • Add Rich Text Ads and Content Snippets automatically on posts & pages.
  • コードスニペットのインポート / エクスポート
  • New Save snippets to Cloud Library – no more wasting time finding Github gists or custom notes. All your snippets stored in your private code snippet cloud.
  • New Gutenberg、WooCommerce などとの緊密な統合。
  • Device specific code snippets (such as load code snippets on mobile only, desktop only, etc)
  • and more features coming soon.


Insert Headers and Footers プラグインは最初、2011年に Syed BalkhiWPBeginner チームにより作られました。

It was later rebranded to WPCode in 2022 by Syed Balkhi to add powerful code snippets features that users were requesting for.


WPCode™ is a trademark of WPCode LLC. When writing about the Insert Headers and Footers – Code Snippets plugin by WPCode, please make sure to uppercase the initial 3 letters.

WPCode (correct)
WP Code (incorrect)
wpcode (incorrect)
wp code snippets (incorrect)



  • WPForms – #1 drag & drop online form builder for WordPress (trusted by 5 million sites).
  • OptinMonster – Get More Email Subscribers with the most popular conversion optimization plugin for WordPress.
  • MonsterInsights – See the stats that matter and grow your business with confidence. The best Google Analytics plugin for WordPress.
  • SeedProd – Create beautiful landing pages with our powerful drag & drop landing page builder.
  • WP Mail SMTP – Improve email deliverability for your contact form with the most popular SMTP plugin for WordPress.
  • RafflePress – Best WordPress giveaway and contest plugin to grow traffic and social followers.
  • Smash Balloon – #1 social feeds plugin for WordPress – display social media content in WordPress without code.
  • AIOSEO – The original WordPress SEO plugin to help you rank higher in search results (trusted by over 3 million sites).
  • Push Engage – Connect with visitors after they leave your website with the leading web push notification plugin.
  • TrustPulse – Add real-time social proof notifications to boost your store conversions by up to 15%.
  • SearchWP – The most advanced custom WordPress search plugin to improve WordPress search quality.
  • AffiliateWP – #1 affiliate management plugin for WordPress. Add a referral program to your online store.
  • WP Simple Pay – WordPress の #1 Stripe 支払いプラグイン。 ショッピング カートを使用せずに、1回限りまたは定期的な支払いの受け入れを開始します。
  • Easy Digital Downloads – The best WordPress eCommerce plugin to sell digital products (eBooks, software, music, and more).
  • Sugar Calendar – A simple event calendar plugin for WordPress that’s both easy and powerful.
  • WP Charitable – Top-rated WordPress donation and fundraising plugin for non-profits.

Visit WPBeginner to learn from our WordPress Tutorials and find out about other best WordPress plugins.


Insert Headers and Footers by WPCode は、WordPress ヘッダーとフッターにコードを挿入する最も手軽な方法です。

私たちの目標は、提供する WordPress プラグインと、最大級の初心者向け WordPress 情報サイト WPBeginner などのリソースの両方によって、WordPress を簡単に使用できるようにすることです。

それは、このプラグインで達成できているように感じています。Insert Headers and Footers がスクリプト挿入に役立つことを願っています。

Syed Balkhi


  • WordPress Code Snippets Management Screen
  • Ready-Made Code Snippets Library
  • Edit PHP Snippets with Code Syntax Highlighter
  • Show / Hide Code Snippets with Smart Conditional Logic
  • カスタム WordPress コードジェネレーター
  • 投稿タイプジェネレーターの例
  • ヘッダーとフッターへのグローバルなスクリプトの挿入
  • コードスニペットのインポートとエクスポート
  • プラグイン内の非公開スニペットライブラリ
  • ページ固有のスクリプトメタボックス


  1. Install WPCode – Insert Headers, Footers, and Code Snippets plugin by uploading the insert-headers-and-footers directory to the /wp-content/plugins/ directory. (See instructions on how to install a WordPress plugin.)
  2. Activate WPCode – Insert Headers, Footers, and Code Snippets plugin through the Plugins menu in WordPress.
  3. Insert code in your header and footer or add custom code snippets by going to the Code Snippets menu.


WPCode – Insert Headers and Footers を Google アナリティクスのインストールに利用できますか。

はい。Google アナリティクスのコードをヘッダー内スクリプトフィールドに挿入してください。

WPCode – Insert Headers and Footers を Google AdSense に利用できますか ?

はい。アカウントを確認したり、ページに自動広告のタグを付けたりするには、AdSense から提供されたコードを「ヘッダー内スクリプト」フィールドに貼り付けます。

Will I lose my snippets if I change my WordPress theme?

No, the idea behind WPCode – Insert Headers, Footers, and Code Snippets plugin is so you can safely add code snippets.

All code snippets are stored in the WordPress database, independent of the theme upgrades.

Can I switch back to the old version of Insert Headers and Footers?

Yes, if you don’t want the advanced code snippets functionality, then you can switch back to the old Insert Headers and Footers features by simply going to the Settings Menu and clicking on the Headers & Footers mode.

What Type of Code Snippets can I add?

With WPCode, you can add any type of code snippet that you would otherwise add in your theme’s functions.php file or in a site-specific plugin.

This includes custom PHP snippets, JavaScript snippets, HTML snippet, CSS snippets, Text Snippets, Conversion pixels, Tracking scripts, AdSense or other banner ads code, and more.

WPCode で代替可能なプラグインを教えて下さい。

WPCode には、以下の人気プラグインを代替可能な、すぐに使えるコードスニペットライブラリが付属しています。

  • コメントを無効化するプラグイン
  • XML-RPC を無効化するプラグイン
  • Disable Rest API プラグイン
  • Gutenberg を無効化するプラグイン
  • クラシックエディタープラグイン
  • SVG ファイルアップロードを許可するプラグイン
  • Disable RSS feed プラグイン
  • 検索を無効化するプラグイン
  • WP Disable Automatic Updates プラグイン
  • Disable Admin Bar プラグイン
  • Disable Widget Blocks プラグイン
  • Classic Widgets プラグイン
  • Remove WordPress Version Number プラグイン
  • Google Analytics プラグイン
  • Facebook Pixel プラグイン
  • Google AdSense プラグイン
  • Custom Post Types UI プラグイン
  • Other WordPress Generator plugins

… and basically any plugin that adds a functionality which can be added via custom code snippets.

WPCode は翻訳できますか。

Yes, WPCode has full translation and localization support via the insert-headers-and-footers textdomain. Based on your site language, required .mo and .po translation files will be downloaded and placed into the default WordPress languages directory.


I needed something very easy to use. This tool helps me tremendously without making me work too hard to understand the processes. Thank you for the assistance!
Perfetto per customizzare temi e altri plugin con codice di vario genere. E' diventato indispensabile.


WPCode – ヘッダーとフッターの挿入 + カスタムコードスニペット – WordPress コードマネージャー はオープンソースソフトウェアです。以下の人々がこのプラグインに貢献しています。


“WPCode – ヘッダーとフッターの挿入 + カスタムコードスニペット – WordPress コードマネージャー” は25ロケールに翻訳されています。 翻訳者のみなさん、翻訳へのご協力ありがとうございます。

“WPCode – ヘッダーとフッターの挿入 + カスタムコードスニペット – WordPress コードマネージャー” をあなたの言語に翻訳しましょう。

開発に興味がありますか ?

コードを閲覧するか、SVN リポジトリをチェックするか、開発ログRSS で購読してみてください。



  • New: We redesigned the auto-insert location picker to make it easier to find the right place to insert your snippets.
  • Fix: We fixed an edge-case where a snippet getting automatically deactivated due to throwing an error would have its code changed.
  • Fix: Inserting a snippet as a shortcode was ignoring the conditional logic rules enable toggle and always applying rules.
  • Fix: We updated the way we check the taxonomy term id when applying conditional logic rules.

  • Fix: Improve compatibility with PHP 8.1 for our error handling class.


  • New: We added the option to log PHP errors thrown by snippets added with WPCode to make it easier to track down issues.
  • New: We added a new auto-insert location to improve the available conditional logic rules you can use with PHP snippets.
  • Tweak: We added more info regarding the error thrown when trying to activate a PHP snippet with a syntax error.
  • Tweak: Conditional logic rules are now also applied to shortcodes for better control of output.
  • Tweak: We updated the code editor for PHP snippets to give you a better experience when editing snippets.
  • Fix: We adjusted the permission checks of some ajax endpoints to avoid any potential unwanted usage.
  • Fix: The Safe Mode notice was no longer being displayed on the WPCode pages, so we added that back when needed.


  • New: We added the ability to resume editing snippets that were created using the WPCode snippet generator.
  • Fix: We adjusted the code output in the editor to improve support for using HTML entities.
  • Fix: We made sure conditional logic rules are loaded correctly in the admin when used globally.
  • Fix: We added an extra permissions check to the library endpoints to limit access.


  • New: WPCode Library public snippets can now be installed with 1-click on sites connected to the WPCode Library – no more copy/paste needed!
  • New: We added a new setting for the editor height, so you can set the editor to a custom height or make it automatically grow with the code.
  • Tweak: We adjusted the “Connect To Library” functionality to improve support for site names with special characters or empty names.
  • Fix: We added extra checks to prevent errors when certain conditional logic rules were being called too early with PHP snippets.


  • New: 2 new bulk actions are available in the admin to allow enabling or disabling multiple snippets at once.
  • New: We added a new search field for snippets in the admin list which allows you to search using all snippet fields.
  • New: When adding a JavaScript snippet, WPCode will attempt to remove HTML script tags, if present.

  • Fix: Added an extra check to prevent errors in setups where the closed metaboxes user option is not an array.

  • Tweak: We updated the default behaviour of our page scripts metabox so that it is collapsed by default.

  • Tweak: Changing SweetAlert library version to prevent the interference on .ru sites.

  • Fix: Don’t show the metabox when headers & footers only mode is enabled.


  • New: We added more free snippets to the snippet library, simply connect your website to the WPCode Library and load them directly from the WPCode plugin.
  • New: We added a new code type for CSS Styles that many of you requested, so now it’s even easier to add custom styles to your site with all the powerful WPCode features.
  • Tweak: We added an extra check to make sure when you copy-paste a PHP snippet it’s easier to use by removing the opening tag, if present.
  • Fix: We fixed a bug where in certain scenarios a snippet’s code would get changed when changing its status from the list of snippets.


  • Tweak: Adjusted the hook used to load “Run Everywhere” PHP snippets to “plugins_loaded” to allow running snippets on earlier hooks.
  • Fix: Adjusted the link in the plugins list to point to the correct admin page in headers & footers mode.
  • Fix: Adjusted logic for headers & footers page when user is not allowed to edit HTML & improved messaging based on permissions.


  • Tweak: Snippets used as shortcodes will no longer be executed if they are inactive.
  • Fix: Conditional logic rules for homepage were not working correctly in all scenarios.
  • Fix: Improved auto-insert location matching to avoid snippets not loading in some setups.
  • Fix: We improved the importer tools to avoid unslashing certain types of PHP code.


  • Tweak: Auto-insert is now the default option when creating a new snippet.
  • Tweak: We updated the way we add custom capabilities to improve a scenario where the plugin needed to be reactivated.
  • Fix: We updated the way PHP code is saved to improve support for backslashes.
  • Fix: We tweaked the Page URL rules that were not matching in some cases.


  • New: Insert Headers and Footers is now WPCode – We make it easy for you to add code snippets in WordPress without having to edit your theme’s functions.php file.
  • New: Full Code Snippets Library – WordPress code snippets library right inside the WPCode plugin.
  • New: WordPress code generators to help you quickly generate ready-to-use code using the latest WordPress coding standards and APIs.
  • New: Conditional Logic for Code Snippets – Instead of learning the various WordPress conditional logic queries, you can use our beginner-friendly conditional logic user interface.
  • New: Auto-insert in various locations of your site or manual code output using shortcodes.


  • Fix: Reverted a method visibility that was conflicting with other plugins using it.


  • Tested compatibility with WordPress 5.9


  • Fix: Only show settings CTA to users able to visit the settings page.
  • Enhancement: Improve settings page user experience on heavily customized WordPress installs.


  • New: Code editors now use CodeMirror for syntax highlighting.


  • Tested compatibility with WordPress 5.4.2


  • Tested compatibility with WordPress 5.3.2
  • Add support for printing scripts right after the opening body tag using the wp_body_open action


  • Tested compatibility with WordPress 5.2
  • Updated text-domain standards and in plugin header


  • Update FAQs
  • Introduce three new filters: disable_ihaf, disable_ihaf_footer, disable_ihaf_header


  • コードをきれいに


  • PHP 5.5未満のユーザー向けの修正


  • WordPress 4.7.2でのテスト
  • コードをきれいに


  • WordPress 4.3でのテスト
  • 修正: マルチサイトと symlink 対応のための plugin_dir_path() と plugin_dir_url() の使用


  • 修正: RSS フィードが読み込めない場合のダッシュボードウィジェットのロゴ URL
  • 修正: WordPress 4.0 対応
  • 追加: POT 言語ファイル


  • WordPress 3.8以上での設定 UI の改善
  • Bumped minimum version requirement


  • Readme ファイルを修正


  • コードをきれいに


  • fixed unnecessary CSS loading


  • 最初のバージョン