While the term 'pastebin' has found its place in everyday geek vernacular, it was Pastebin.com that effectively pioneered the service. Created it 2002, Pastebin took nearly 8 years to reach the first million pastes, however, the service now boasts nearly 70 million pastes with over 75 percent marked as private or unlisted. Because Pastebin allows anonymous text (and code) to be posted online it has become a defacto destination for those pasting anonymous news, text, and hacks (for example, during the 2014 Venezuelan protests, Pastebin was blocked by the government as one of the sites where activists were sharing information). The hacker group Anonymous are also known to use the service to paste hacked usernames and passwords. That dark usage aside, the site is an excellent means of quickly sharing information.
Services such as Github (and in particular Gists) have become more popular because of the versioning control and other advanced features that other earlier services often lack. Github is almost certainly a more reliable, feature-rich, and cosmetically appealing location to store more permanent code.
Using the shortcode of
[pastebin id="https://pastebin.com/vQrmq3HV"] the following paste will be posted into your WordPress post or page.
[pastebin id="prUbcTmh" js="0" height="300"]. The result:
You should set a default height in the shortcode function to negate the need to define it every time you use the iframe feature.
idis either the pastebin ID or the full paste URL.
js="0") you should specify the iframe height as
height="400". You can set the default height in the shortcode function.
The Shortcode Function
Copy and paste the WordPress function into your theme's
functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.
Function to be used outside WordPress
Used outside WordPress, the following PHP function should be used: