Passing Current User ID into SQL statement

No need to use []… just use simple single quotations (also no quotations does the job): $sql =” SELECT … WHERE wp_users.`ID` = ‘$userID'”; OR $sql =” SELECT … WHERE wp_users.`ID` = $userID”;

How can i create a function tag in my plugin

You are looking for Enclosing Shortcode. Here is an example of how you can achieve this. function example_shortcode($atts = [], $content = null) { // do something to $content // run shortcode parser recursively $content = do_shortcode($content); // always return return $content; } add_shortcode(‘example’, ‘example_shortcode’); Now you can use it like [example] Here is my … Read more

How to display category and tag descriptions in a post

First of all, remember that a post can have multiple categories, so you’ll have to handle an array and then print the results. To get see what categories are attached to your post, print the value from the get_the_category function inside a <pre></pre> (which formats the code): $categories = get_the_category(); echo ‘<pre>’; var_dump($categories); echo ‘</pre>’; … Read more