Created
December 3, 2017 19:00
-
-
Save ideadude/84f0b08e41f612c5137596785bc698a6 to your computer and use it in GitHub Desktop.
If a post has a code block, add a GPL note to the bottom of the post. (For Gutenberg issue #3773)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* If a post has a code block, add a GPL note to the bottom of the post. | |
* This gist is meant to be run with the pull requests related to this | |
* issue on the Gutenberg GitHub repo: https://github.com/WordPress/gutenberg/issues/3773 | |
*/ | |
function test_mark_code_posts_for_gpl($content) { | |
if(gutenberg_content_has_block($content, 'core/code')) | |
$content .= '<p><strong>All code in this post is licensed under the GPL.</p>'; | |
return $content; | |
} | |
add_filter('the_content', 'test_mark_code_posts_for_gpl', 5); //gutenberg currently renders blocks on priority 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment