How to edit post meta data before publishing the post it self wordpress?

You can use save_post action which gets triggered when a post is created or updated. https://developer.wordpress.org/reference/hooks/save_post/ In your function, you will have to check for your custom post type, set the value you would like to have to a variable, and pass it to the update_post_meta function with giving the name of your custom field. … Read more

How to limit the number of custom posts certain users can publish in WordPress using php script?

Welcome to StackExchange! I made some changes to your code that I pointed out with comments. I’m not sure if this will actually work so you have to try it, and probably your way of echoing the message won’t work because after updating there’s a redirect so you’ll have to work with the admin_notices action … Read more

Learndash: Customize user enroll time

Learndash wrote me with a filter: /** * LearnDash Lesson Access From * * This filter is called when using the learndash lesson drip feed options. This filter allows override timestamp value. * * @since 2.4 * * @param int $gmt_timestamps This is a GMT timestamp value like 1489062972 * @param int $lesson_id The Lesson … Read more

use php variable in wordpress page

As said by sabbir you have to create a custom template to use php code, other way is to register a shortcode and the use that shortcode on new page. creating shortcode is much easier, you can paste the code below in functions.php and then use [new_form] shortcode on your page. You can modify the … Read more

location lock wordpress website

There are open/free APIs that allow geolocation based on the IP address. IP address of a mobile should be geo-correct. I use this site, with a CURL function to return the Geo information. Go to the URL in the code to get details on the return values. function grabIpInfo($ip) { //$ip = ‘185.164.57.189’; // france … Read more

image uploader for widget

I think you facing issue of save button not clickable here. If I’m right about that a tiny line of javascript will solve the problem. Modify following portion of your javascript with mine: CODE UPDATED** imageUploader.on( “select” , function(){ var image = imageUploader.state().get( “selection” ).first().toJSON(); var link = image.url; $( “input.image_link” ).val( link ).trigger(“change”); $( … Read more

Show data obtained from a function and place it in a shortocode function

I don’t really understand what you’re trying to do. Why don’t you just call the function inside the shortcode handler? This looks more like general PHP question. Say we have a variable in our functions.php or wherever you define your shortcodes: $another_var = doSomeFunctionThatReturnsData(); With modern anonymous functions, you can pass variables using the use … Read more