Well, yea you kinda can do that. But it’s bad practice and it’s strongly discouraged. Cause when you call parent function the nested function is being called automatically. So basically the nested function is being called twice. Better and safest way to do it like-
// Include the file or write the nested function outside of the parent function
include (__DIR__.'/api/short_look_up.php');
function short_api($atts){
$api_info = get_api_info($atts);
return $api_info;
}
add_shortcode('apii', 'short_api');
Related Posts:
- Include PHP file in Content using [shortcode]
- get_template_directory_uri pointing to parent theme not child theme
- Solution to render Shortcodes in Admin Editor
- Use AJAX in shortcode
- Shortcode producing headers already sent error
- How to add attributes to a shortcode
- How to display random users with avatars
- Enabling shortcodes for custom fields
- How to use get_media_embedded_in_content function
- Can shortcodes contain conditional statements? Even without them my shortcode renders blank page
- Shortcode with parameters inside parameters
- Creating a table from shortcode avoiding wpautop for each row
- Changing a function in function.php to a shortcode – for listing categories of only a certain post type
- Stripping shortcode from custom excerpt function
- how to create shortcode in wordpress
- What is wrong with this Shortcode? I get it in a wrong place inside the content
- Display random text from a file with the WP built-in AJAX API
- Set first oembed in post to a global variable or function
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- Formatting post content to exclude gallery
- Remove images from get_the_excerpt
- Shortcode with custom content attribute?
- Problem with extract() with custom shortcode
- Shortcode to insert menu in page body?
- Using locate-template & shortcodes doesn’t appear to work
- Displaying a random user with a shortcode
- Passing HTML in WordPress Shortcode arguments
- Adding body class when post contains a specific shortcode
- What is the most efficient method for loading widgets in functions.php
- Function to show only first instance of shortcode
- Display a text message if the shortcode is found?
- creating shortcode to pull json array
- Custom Shortcode, functions PHP WP_Query loop
- Pass Shortcode Attribute to footer Script
- Super simple shortcode not working
- Detect Safari desktop browser and include the detection in a shortcode
- My simple custom shortcode is not longer working (possibly due to upgrade to WordPress 4.4 ?)
- PHP files included in functions.php don’t seem to work
- Display gallery on top before content
- List child pages of specific page using shortcode
- Include files in child themes, declare in functions.php
- How to extract the variables out from “add_shortcode” function?
- Display first name of logged in user?
- How to get specified parent page title in my function
- Possible to display shortcode based on the category?
- WordPress shortcode attributes for database SELECT?
- Shortcode pagination not advancing
- create shortcode to list users with specific meta key value
- Variable if post is sticky in functions.php
- Having issues with a foreach inside of a shortcode with ACF gallery
- using `require` in my functions.php breaks the site
- Shortcode inserts paragraphs before and after executing shortcode
- Calling a Function in Functions.php from an external PHP script
- Display post shortcode content in the sidebar?
- How to get the index number of the posts?
- Using shortcode content with nested shortcode
- How can I make a widget shortcode to control all the widgets?
- Custom shortcodes not inserting into visual composer columns
- How to filter $content in shortcode function
- Create a custom taxonomy that will be used to create and filter markers in a Google Map
- Setting youtube size in functions.php
- Automatically include all php files in a child theme directory
- Adding a colorbutton in tinymce dialog with current api
- Passing variable as add_shortcode argument
- Display gallery on bottom after content
- Add button to kitchen sink toggle
- Impossible to call wordpress function inside an include?
- Excerpts are not displayed by a shortcode on category pages
- WordPress Shortcode function display outside of widget
- check if the user is owner of current page
- shortcode help require
- Optimizing a WordPress site
- Help With Creating Shortcode
- Use html inside shortcode function
- Can I have an additional functions.php file in WordPress?
- Shotcode argument issues
- Shortcode parse error – wrong syntax
- Exclude category from shortcode
- wp_nonce_field is breaking form for reasons unknown
- Visual Composer creating own shortcodes with vc_map() to return simple Image
- get_pages() Returns Only One Item
- wp_star_rating() – Adding a 5 star rating system to theme
- Function shortcode – Set Parameter
- Adding an option to a shortcode
- How to use author meta in shortcode?
- Using multiple line variable inside a function?
- Testing for a shortcode using a function. 404 page throwing PHP Notice
- Use a shortcode to display custom meta box contents
- Echoing function into WordPress NextGen gallery
- Output loop to function return?
- How to echo the value of an array element using a function via a shortcode
- Wp-query Order By problem
- How to parse a shortcode within a shortcode?
- Variables not showing in short code
- Woocommerce checkout field
- How to include any template using Shortcode fuction?
- How can I pass a shortcode value to the head in wordpress functions.php
- Native gallery custom html output
- Need to convert image url to a Base_64 data url with wordpress function..
- dynamic site link for future migration in echo do_shortcode()