{"id":18841276,"url":"https://github.com/dmhendricks/wordpress-output-buffering","last_synced_at":"2025-10-17T00:58:33.252Z","repository":{"id":88694433,"uuid":"97749194","full_name":"dmhendricks/wordpress-output-buffering","owner":"dmhendricks","description":"A simple mu-plugin that buffers the entire WP process, capturing the final output for DOM manipulation.","archived":false,"fork":false,"pushed_at":"2018-11-17T01:02:05.000Z","size":15,"stargazers_count":15,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T12:07:18.363Z","etag":null,"topics":["dom-manipulation","mu-plugins","output-buffering","wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmhendricks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-19T18:33:29.000Z","updated_at":"2024-09-29T11:41:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"3875cd85-fc98-41c5-b148-e4515f862ccc","html_url":"https://github.com/dmhendricks/wordpress-output-buffering","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmhendricks%2Fwordpress-output-buffering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmhendricks%2Fwordpress-output-buffering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmhendricks%2Fwordpress-output-buffering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmhendricks%2Fwordpress-output-buffering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmhendricks","download_url":"https://codeload.github.com/dmhendricks/wordpress-output-buffering/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837287,"owners_count":21169374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dom-manipulation","mu-plugins","output-buffering","wordpress-plugin"],"created_at":"2024-11-08T02:50:38.703Z","updated_at":"2025-10-17T00:58:28.190Z","avatar_url":"https://github.com/dmhendricks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WordPress Output Buffering\n\nA simple [mu-plugin](https://codex.wordpress.org/Must_Use_Plugins) that buffers the entire WP process, capturing the final output for DOM manipulation.\n\n[Original code](http://stackoverflow.com/a/22818089/3799374) by [kfriend](https://stackoverflow.com/users/419673/kfriend) on Stack Overflow. Licensed as GPL because it is a WordPress derivative.\n\n## Installation\n\nTo install, simply download and copy `output-buffering.php` to your `/wp-content/mu-plugins` directory.\n\nRequires PHP 5.3 or higher.\n\n#### Tip\n\nUse [HtmlPageDom](https://github.com/wasinger/htmlpagedom) in conjunction for jQuery-like DOM manipulation in PHP.\n\n## Usage\n\n##### Simple Example\n\nThis code will replace any instance of \"foo\" on the web page with \"bar\":\n\n```php\nadd_filter( 'final_output', function( $output ) {\n    return str_replace( 'foo', 'bar', $output );\n});\n```\n\n## Configuration\n\nBy default, output buffering is only **enabled** on the *frontend* of the site and is **disabled** for *WP Admin* and during *AJAX* requests.\n\nYou can modify this behavior and specify on which request/screen types that you want to enable it by adding the following constants to `wp-config.php`:\n\n#### PHP (PHP 5.3+)\n\n```php\ndefine( 'OB_ENABLE_ADMIN', true ); // Enables output buffering in WP Admin\ndefine( 'OB_ENABLE_AJAX', true ); // Enables output buffering during AJAX calls\n```\n\n#### PHP 7.0 and Higher\n\n```php\ndefine( 'OB_REQUEST_TYPES', array( 'site', 'admin', 'ajax' ) ); // Case-sensitive\n```\n\nIn the example above, output buffering is enable on the frontend (\"site\"), in WP Admin (\"admin\") and during AJAX requests (\"ajax\"). Add or remove from the array as desired. For example, to **only** load output buffering in WP Admin and **not** on the frontend or during AJAX calls:\n\n```php\ndefine( 'OB_ENABLE_SCREENS', array( 'admin' ) );\n```\n\n#### Caution\n\nTake care when changing this behavior! You may experience issues when enabling in WP Admin or during AJAX calls if your manipulation logic interferes with normal WordPress function.\n\nAlways test first before using in a production setting!\n\n## Changelog\n\n**1.0.5**\n* Disable output buffering for WP-CLI\n\n**1.0.4**\n* Disabled for WP JSON (Gutenberg compatibility)\n\n**1.0.3**\n* Added `wp-config.php` constants to control where output buffering is enabled.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmhendricks%2Fwordpress-output-buffering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmhendricks%2Fwordpress-output-buffering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmhendricks%2Fwordpress-output-buffering/lists"}