How to make rand() function static in WordPress
P粉099000044
P粉099000044 2023-09-11 11:16:15
0
1
547

I use wp_schedule_single_event() for scheduled publishing, and the value of post_content uses [shortcode]. I'm using rand() to generate random numbers and want to put them into each post.

The problem is, I want this random number to become permanent/static. So, every time you refresh the article, this number won't change.

P粉099000044
P粉099000044

reply all(1)
P粉402806175

You must return the first rand() value stored in your post's post_meta, when you call your shortcode, check if the value exists, if not generate a value, if it exists use the value stored in Value

in your post_meta
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template