Solution found: the reason was that the code including those lines were included in plug-in’s main file and were wrapped in the shortcode launch anymore.
I had to put things in another file,like for example
function load_shortcode( $atts ){
require_once(getPluginPath().('my-project.start.php'));
}
add_shortcode( 'my-project', 'load_shortcode' );
and lines had to be in my-project.start.php
getPluginPath()
is NOT a native WordPress function, don’t look for it, the only thing to know here is that it generates a path string.
Related Posts:
- Create a global variable for use in all templates
- Can i check if user is doing any ajax request?
- How can I default to all WordPress roles when parameter is not included in shortcode?
- Get users that likes the post
- Use of antispambot with $curauth->email
- Uses for function: wp_update_user
- Change wordpress’ database data using ajax – how to get current user id?
- Allow a user or role to view drafts and previews, but not other admin privileges?
- Get current user id in function php
- Display current user metadata on WordPress page
- Add another role to a user when they click a button?
- is_user_logged_in() not working in homepage
- Can’t get_users info by using json_encode
- Matching multi user
- Private messaging – Getting and displaying the avatar/url of a message recipient
- main menu page redirects to user ID
- Get author meta of all writers
- Display a list of users with avatar filterable with alphabets
- Cross origin ajax request always returns 0 when calling get_current_user_id();
- Custom Admin Menu Report for Specific User ID
- start_lvl Ignored in Custom walker_nav_menu
- Allowed memory size of 268435456 bytes exhausted (tried to allocate 7146491840906359738 bytes)
- How do I make my function add variables/values to the $post object?
- How do I get the author’s page url from their ID?
- Calculate percentage of post by category
- Change comments form title on a page by page basis
- Get the title before comma
- How do I know what variables are passed in a filter/action and what their meaning is?
- “Can’t use function return value in write context” error
- Display 4 chronological posts starting with a random post
- my function doesn’t return my post from today
- Wrap each shortcode in array to div
- Warning: array_pop() expects parameter 1 to be array, boolean given
- Check if Product is in a Specific Category in Functions.php
- How to Display Image Meta underneath EVERY image in EVERY post
- get_the_terms – only top level
- Have CSS Class Added with `is_page()` WP function
- Limiting woocommerce line_total decimal length
- Run a filter when a walker runs
- Swapping wp_dropdown_categories function with wp_category_checklist
- Display fields as values in array from external SQL DB
- User’s total comment count excluding comments on their own posts
- Populate dropdown with Child Pages based on Parent Page chosen
- How can I remove a function that has been added to wordpress with add_filter?
- Get value from shortcode to do something
- Custom shortcode outputs plain text instead of HTML at top of post
- how can i use $_COOKIE[] + PostID to execute the below code?
- What’s the uses of wp_cache_set() or wp_cache_add()?
- Create Page To Count Comments For Each Post In WordPress Site
- Can’t find infinite loop cause
- how to make custom ajax handler?
- responsive.css in the WordPress should be prioritized
- How to display login form anywhere, when user isn’t logged in, without redirecting?
- Widget back end radio button issue
- php if username is role
- GET problem in WordPress
- HTML Special Characters in URL string [closed]
- Create page template via functions.php?
- Send a mail to specific address in a custom field when a new comment is made on a specific post
- CSS change in woo commerce Place Order Text [closed]
- WP All Import / Update stock quantity from multiple XML files
- Change MySQL PDO connection to a WPDB connection
- Hide a div when a custom field is empty
- Can’t log in to WordPress wp-admin after adding code to functions.php
- How to change basename url for wp-admin?
- Woocommerce display orders with products from specific categories to specific admins
- How to exclude meta no index pages from wp_list_pages
- Products listing check if meta checkbox is checked
- Search by date in WordPress
- Hide a div if the fiels is empty
- Illegal string offset checkbox
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- Trying to add some custom text into WordPress Post title via function.php
- Call WP Rest-Api to GET /users/me returned NOTHING in console
- Edit a function to take different actions based on user role
- If user has clicked link add class and store using PHP/WordPress
- How to put 2 php codes in functions.php without site crashing
- I got big white screen when i attach main style sheet of Html in functions.php
- Using Javascript On Page – Header and Footer Now Missing
- Unzip_file causing Media file upload error
- How to generate customized filtered output for the gallery
- Editable Student file associated with basic User ID
- Escaping a Single Quote in str_replace for Nav Function
- Updating custom user meta
- Display Year and Month from custom field + Age Calculator
- insert thumbnail image from php script
- WordPress rating by views [closed]
- Trying to see if page is category or single and displaying title with appropriate heading tag
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- Fix My Custom Function: Remove Automatic
- WP Debug enabled Undefined index error in a widget
- WP Fatal error: Call to undefined function get_template_directory_uri()
- Remove default Image Sizes
- A better way to write this php function
- Dynamic Email Handler with ‘header (“Location: …’
- How to lock users account until approvation
- WooCommerce: write featured image dimensions to custom fields in product’
- How to create a User Role and give permission to only use Web Stories plugin?
- transition_post_status hook, works – but not if the post is new
- Custom plugin doesn’t show in admin menu – when code added, displays an empty page