Call to undefined function get_userdata() in plugin

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 … Read more

php syntax : [ && ] between commands [closed]

I think its actually not allowed or discouraged in WP coding standards. Its is basically saying “If true go ahead”. It’s a short form of this: if ( did_action( ‘init’ ) ) { $scripts->add_inline_script( ‘lodash’, ‘window.lodash = _.noConflict();’ ); } You can also think of this as if it’s inside brackets of an if statement … Read more

How to Create a shortcode to this php function

You can use the add_shortcode function to do that. You just need to pass your isa_before_add_to_cart_form function as a shortcode like this: add_shortcode( ‘isa_show_link’, ‘isa_before_add_to_cart_form ); Now you can use the shortcode [isa_show_link] to display it anywhere. It’s simple.

Can I use a jQuery Ajax request in Code Snippets Plugin for WordPress?

You’ll need to look at the server side logs to see what’s actually causing the 400. Without this, it’s just conjecture. With it, you should see exactly what’s causing the problem. However, I conjecture that you’re lacking authentication headers, or an authentication request. I’m not seeing anything related to authentication in your AJAX request, and … Read more

Can anyone offer any help with this function?

The filter you are using posts_where affects the creation of SQL query, so by definition it is executed before query runs and you have any search results. So you cannot loop through results at this point, what you can do is retrieve or hardcode list of unwanted items from elsewhere and use them to modify … Read more