First of all. The question is a little misleading. What you actually want is “post id(s) for current user”.
Here we go:
// Global variable for current user ID
// More information: http://codex.wordpress.org/Function_Reference/get_currentuserinfo
$user_ID;
// You need to create a new WP query object
// More info: http://codex.wordpress.org/Class_Reference/WP_Query
$my_query = new WP_Query( array(
'post_type' => 'farmers',
'author' => $user_ID
));
// You get all the current user posts from the query object
$posts = $my_query->posts;
// You get the first post from the posts array
$first_post = $posts[0];
// You get the post ID from post object and store it to $gform_post_id variable
$gform_post_id = $first_post->ID;
Now you can echo that $gform_post_id in your URL
echo 'http://example.com/dashboard/form_page?gform_post_id='.$gform_post_id;
Cheers
Related Posts:
- How to Loop Through all Posts and Count Attachments using Get Media Attachments
- When unit testing a plugin, does the plugin need to be in the wp-content/plugins directory of the WordPress tests install?
- How can I prevent a plugin from updating unless it’s minimum PHP version is met?
- Simple form that saves to database
- How to call plugin path in JS?
- Get Current user email as a return string value
- How can I make content disappear when a user logs in?
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- Determining where fopen() is writing files when used from WordPress AJAX call [closed]
- How Restrict access to admin dashboard by specific static ip?
- New Plugin: Post update pushes a copy as a revision
- Overide a function that is inside a plugin
- How to get images from EDD post?
- How to install and activate a plugin via an external PHP script
- How to remove xmlns on language_attributes()?
- How to initialize something in unit test before the init hook being called?
- Add category to body class
- Add keywords meta to index.php page
- Download any file after submitting a form [closed]
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- woocommerce 3.2.1 not sending order notification emails
- Executing my function once on a specific time
- Using meta_query to get date type values from post_meta table WordPress
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- wp_get_post_terms is difference obj model than the one in rest api response
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- Using plugin functions/methods within templates
- WordPress shows error related to allow_url_fopen
- Delete mobile menu button [closed]
- How to replace WordPress Media Upload Window with user’s device window?
- How can integrate zend module with wordpress admin dashbord [closed]
- Setup wp_schedule_event within a custom plugin
- WordPress custom taxonomy not showing
- Does having more than 30 Admin Ajax affects site performance (plugin)?
- execute function after one completed
- WHy custom plugin slows down the loading of the pages?
- Adding media upload button to User Profile page (following a tutorial)
- Pass user role to javascript code inside body
- Integrating boxtal PHP library into a custom WordPress Plugin
- How to get specific string/value from an array? php [closed]
- WordPress Stock Update Programatically
- UTF-32be error WordPress
- Background Music WP [closed]
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- Customize Menu | Styling LESS/SCSS code formats
- Why is it important to check for isset and is_array before checking in_array in this example?
- How to delete a theme using AJAX
- same user role or copy the user role to be same as the other role
- Equivalent of admin.php for public pages
- Social share buttons text shows up on post excerpts
- How to add custom function to pluggable.php
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- Plugin Admin panel checkbox unchecked after submit
- Getting URL GET parameter with Code snippets and storing it in database?
- Send Array from JS to php file then insert it in wp database through a plugin
- Offer Download Links for Product Images
- WooCommerce – new order email hook
- save_post_product action not firing
- How to get the custom field value using SQL query
- Editing a coupon generating plugin
- WordPress fatal error from php protocol codes
- Possible way of having multiple Gutenberg instances for a page?
- Display pagination in reservation Plugin and and Print table as pdf
- Changing wordpress/woocommerce notices default message to other languages (text)
- Why does my custom plugin only function correctly once per page?
- How to change a wordress plugin php code in my child’s functions.php file?
- What is the right way to populate a dropdown from MySql?
- make p tag collapsed after 3 rows
- I can’t view the orders on the woocomerce dashboard with the brainblocks plugin
- Generate and send ICS file through WordPress
- WP Plugin permissions – create new files
- Run a Change Role Cron Job on WordPress via cPanel
- How to display variables from plugin?
- How to make the first letter of a post title uppercase, in a plugin?
- Creating Admin Submenu Page via Class Method
- .htaccess file doesn’t work, with hundred tries
- How to change the product short description for each product with PHP?
- I want add repository theme folder
- ACF Repeater Field Question [closed]
- How to create a dashboard for logged-in users with custom functionality? [closed]
- plugins_loaded action is not working properly
- Creating a user ‘add custom field’ section
- Cannot access variables within a widget
- How do I convince this button to do something when it is clicked?
- WordPress function to add text
- TheCartPress plugin – Make every item in store unique
- Doing action based on input from options menu
- Insert dynamic content into posts
- avatar displays outside of targeted area
- WordPress User Frontend Editing Custom Fields
- My wordpress site wont load, it gives header error warnings
- Can anyone see a syntax error in this? [closed]
- Fast Tranfering my WordPress site to another server
- Duplicating wordpress install issue
- how to show selected options drop down menu values in attributes field in after saving post.php
- Can’t use updated variables in handle function
- Make plugin admin page visible to other roles
- How Create LastMod and Update Date Only on Taxonomy Category and Tags
- Accessing Correct Database to Create REST API Endpoint
- How do I replace a logo image that’s hard-coded into a plugin’s logo.php file?