Use 'author' => get_current_user_id()
as an argument for get_posts()
. This will restrict the found posts to these of the user which is currently logged in.
The best reference for the available parameters is still WP_Query::parse_query()
in wp-includes/query.php
. It is not exactly an atomic function, but you can find parameters not documented elsewhere – like this one.
Tow notes abut your code:
- Your
onchange
handler looks a little bit strange. It doesn’t do anything, does it? - Do not use
get_the_title()
for attribute values. The post title can contain markup.
Usethe_title_attribute( array ( 'echo' => FALSE ) );
instead.
Related Posts:
- How to manually fix the WordPress gallery code using PHP in functions.php?
- Shortcode putting html such as
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- Shortcode created to check language not works
- Add/echo div with Analytics-Code to function in functions.php
- Custom plugin issue when trying to use the shortcode twice on a page [closed]
- How can I default to all WordPress roles when parameter is not included in shortcode?
- WordPress menu deletes when trying to add a hook
- How to find the output of contact form 7 shortcode? [closed]
- Wrap each shortcode in array to div
- Recent post display using shortcode
- Nested shortCode functions in the functions.php file
- Making Quote Plugin more efficient
- Placing raw HTML inside a WordPress shortcode
- Shortcode content output but not in correct place
- is_page “range” for if statement?
- PHP code inside shortcodes
- Shortcode content filter?
- Trigger popup in a php if/else statement
- How to output a PHP file values by shortcode?
- Showing content from one page on another
- Get value from shortcode to do something
- Custom shortcode outputs plain text instead of HTML at top of post
- Pass php dynamic variable to shortcode
- How to Reference/Echo Variable from Another PHP Function
- Remove echo from shortcode
- Shortcode with PHP issue “Undefined index”
- Shortcode from a function not working
- Display Data in Table from External Database in WP using Shortcodes
- Download PDF after CF7 form submission
- Is it possible to return content, and then also continue to do other things?
- ::before on open/close function [closed]
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- Creating WordPress Shortcode with Variable
- Shortcode to find and replace URL
- Help with WordPress function inside a shortcode
- calling a custom field value inside functions.php
- Export Form Data to a CSV then send it as an attachment – contact form 7
- List all blogs, but exclude the main site
- Shortcode to embed Edit Account form not working
- Shortcode for Listing Users from Meta Value?
- Cant display an image via PHP in wordpress
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- AJAX function not working [closed]
- Updating Metadata with Shortcode
- Display logged in user name and lastname on page
- Create shortcode for metabox gallery
- Display Visual Composer shortcode if a post belongs in specific categories
- Why is the current page loaded in the pop-up window and not the specified one?
- How do I reopen the (Popup Maker) after entering the correct password for a password protected page?
- Block error message in foreach loop when looping through ACF field
- How can I prevent a shortcode div from extending beyond its boundaries?
- PHP multiple forms, same page, isset($_POST[]) not working?
- Gravity Forms: How to add PHP function to confirmation conditional shortcode?
- wpdb->query returns different value to phpMyAdmin
- shortcodes, custom php and their errors
- Display a custom name when the user has no name settle in his account
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- How to use Contact Form 7 shortcode value in a page?
- Display current user metadata on WordPress page
- Reload page with a different shortcode when a user selects from a dropdown
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Offset with ajax load more posts duplicates
- Get posts by id using shortcode
- Shortcode’s output to use as other shortcode’s parameter
- Open/closed function [closed]
- Need to Echo A Url path to show on a wordpress page
- Wrapping shortcode content in a span or link
- Need help with PHP functions
- How to have Function of a plugin using global vars into a shortcode?
- Overwriting a Shortcode
- Shortcoding with Divs
- Send foreach $_post method to contact form 7 [closed]
- Whats wrong with my code? Need To add String to shortcode? [closed]
- My title is showing after the shortcode
- Integrate Razorpay quick payments plugin with contact form7 plugin
- A next page function with shortcode?
- Shortcode to include PHP file, pass various parameters to include?
- Saving User Input to PHP Variable
- Contact form with dynamic dropdown and filter
- WP Custom tables query
- Display terms on product page with shotrcode
- How call WordPress shortcode inside function file
- Show Login Errors In WordPress/Elementor (Code “works”, but breaks site)
- Cleaning up WordPress to improve performance?
- How can I modify the permalink via a filter?
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- Search not showing all results
- How can I hook into the wp_mail function used by BackWPup?
- How to Redirect Buddypress Directories To Login Page For Non Logged in Users
- How to Add a cutsom slug to my custom author role
- How to output the taxonomies that are assigned to each custom post?
- Conditional formatting on data fetched from MYSQL
- What is wrong in this code?
- perform mathematical operation on shortcode
- Do_shortcode on PHP file outside theme ALMOST works
- Woocommerce – Shipping tax class based on cart items not using the highest tax available