It’s just [link to= "https://wordpress.stackexchange.com/"].
This is a textbook example of why extract() is bad. You can’t easily tell where variables are coming from. extract() creates variables out of an array with the keys becoming the variable name. So this part:
extract(shortcode_atts(array(
"to" => 'http://net.tutsplus.com'
), $atts));
Is creating an array with a to key, set to http://net.tutsplus.com if it’s not defined in $atts. Then it’s extract()ed so that the to key becomes $to.
You should avoid using extract() and just use the $atts variable:
function link($atts, $content = null) {
$atts = shortcode_atts(array(
"to" => 'http://net.tutsplus.com'
), $atts);
return '<a href="'.$atts['to'].'">'.$content.'</a>';
}
Related Posts:
- How to add a shortcode button to the TinyMCE editor?
- Custom media upload content for inserting custom post shortcode
- Checking if an attribute exists in a shortcode
- enqueue script only if it is not already enqueue
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- How To Ignore a Filter On Applying Filter the Content In a Function
- Shortcode display outside the div
- Pass $this to function nested in another public function of the same class
- shortcode doesn’t work
- How to add inline css/js inside a shortcode
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Any Short code Availble for Get Post List With Thumbnail Plugin?
- Where to call add_shortcode function in WordPress Plugin Boilerplate?
- Input with spaces in Shortcode attributes overwritten by defaults
- Allow users of my plugin to define their own shortcode rather than use mine?
- Making a Template for a CPT created by a plugin
- creating html reusable blocks via shortcodes
- Single API call exposed via shortcode with params
- Creating shortcodes in plugin
- How to create a custom shortcode based on the layout?
- Inject HTML meta tag inside wordpress tag using add_shortcode
- Create shortcode to echo javascript
- Redirect to another page using contact form 7? [closed]
- Namespaced shortcode?
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- Why am I unable to load scripts in head in plugin?
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- IF condition based on wp_remote_get output
- Shortcode Attributes to Return different $_POST
- How to use template inside plugin shortcode with variables for big HTML code
- strange shortcode error: does shortcodes requires any dependency?
- How to rewrite URL and get the values?
- Thumbnail image doesn’t show up in Shortcode output
- list of custom post by custom field in frontend
- Shortcode do not return the right data in post
- How to call function in WordPress on button click?
- Hide content for specific users with id
- Why is my shortcode not working?
- WP Plugin CSS not being applied to page
- Modify Plugin PHP Class in Child Theme – Correct Method
- Shortcode in a blog post, footer and related products stop working
- shortcode which is introduced into entry the blog, and appears in side bar
- Why function hooked using object are executing at all time?
- Shortcode registered from a plugin not recognized
- Any way to hook into WP after a page displays?
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- Display file contents within Plugin
- How to get next day date of a specific day
- Where can I find a schema of wordpress plugin core architecture?
- PHP Deprecated: Non-static method should not be called statically
- Calling function from within functions.php returns unwanted value
- WordPress network: set themes and plugins for new blog
- Admin-ajax.php is dying “0” without processing function
- How do I register a stylesheet inside a WordPress widget?
- How to remove an Ajax action
- Has anyone used require.js for handling plugin scripts?
- Multiple files in a plugin
- adding a new value to a serialized array in WP_option table
- Write to / remove from default .htaccess file from plugin?
- HTML in WooCommerce settings
- Redirecting to home page after login as custom role WordPress
- Where (or when) should I register a new taxonomy?
- How to stop activating a plugin and show admin notice when dependent plugins minimum version is not met
- Fixing WordPress’s Bug (failed to send buffer of zlib output compression) results in “White Screen of Death”
- How can I make my metabox appear?
- Consolidate plugin functionality into a theme
- qTranslate remove default directory from link
- Customised plugin failed to install and activate
- Why is one phpunit test throwing an error on one class when all other classes are similar without error?
- How to get all posts belongs to a user between a certain date
- wp-load.php redeclares classes
- Plugin main file is constantly been fired on every website visit
- Where should custom post types be registered in a plugin?
- License validate function
- plugin uninstall function drop the tables, but shows errors on admin
- Way to send multiple values for column to MySQL?
- What’s the right way to implement functions in footer.php
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- Display my plugins content based on a pages post_id
- Make get_permalink() work outside the Loop using filters
- Pluging with content for a specific page or post
- Does WordPress do any internal caching if no plugin installed?
- WordPress Plugin- How to Insert Html&JS code in specific Page and specific Div
- Upload Image with a file URL and show dynamically on Frontend
- How can i solve php upgrade problem
- custom post type get_posts() function not work
- Create multiple posts when a custom post is created
- how override a define
- WordPress plugin blog creation
- Preserving existing functionality converting HTML to WordPress
- submit form data to wordpress existing database table using my plugin
- Get content and send to 3rd party
- Is it possible to get a shortcode generated by a plugin, then, using a function, create a new post using that shortcode?
- Add predefined values to custom post plugin
- Custom shortcode with dynamic rewrite
- apply_filters to content but ignore shortcodes
- Outputting custom field query from a plugin to the website header
- plugin doesn’t retrieve data from database
- Display Any Field fromAdmin Panel in Frontend via Shortcode?
- I want to create a search option for CPT using plugin. The search options should search for categories and tags