Using a plugin to run PHP code inside your content is not the sanest thing to do, especially when said code is not idempotent.
Basically, you cannot guarantee that your code will only run once per page load, since several different things in the system may be processing your content, and thus executing your code, multiple times.
Instead of using Exec-PHP to store the code in the post content, create a Page Template which contains your code, then attach it to the Page in question. Also, rewrite your code so that calling it multiple times doesn’t produce incorrect results (people often double-click buttons and such on the web).
Related Posts:
- How to select WooCommerce products by post_meta and order them
- How to create Loop code for Menu using WordPress?
- Fatal error: Call to undefined function mysql_connect()
- Query both first_name and last_name from wp_usermeta at the same time
- How to add query vars with paginated URLs?
- How to Join two tables from separate databases within WordPress
- tag search using WP_Query
- simple wordpress ajax plugin not working when not logged in
- How to add active class to custom menu using while loop and wp_list_pages
- Post from one loop in different containers?
- Custom Loop Pagination on WordPress
- delete an array element when its date expires
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- User Defined order on get_categories?
- if statement on database query
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Woocommerce – How to get products which have a sale between 20% to 40%? [closed]
- Sortable admin column for one meta key with three possible meta values
- WordPress Ajax Custom Query – High CPU LOAD
- AJAX in WordPress, sending coords data to MySQL and show after into map
- When would you use $_post instead of $post?
- Styling images coming from another blog
- Must Use Plugin Causing Query Error
- Advanced Custom Fields: Post Object – Not returning data [closed]
- How to convert objects into arrays
- Ajax $wpdb not returning table data
- Is there a way to get 3+ dimensional array from a single MySql command
- have_posts() execution failure
- How can I add multiple ‘tax_query’ arrays via a loop?
- Can’t get wp_insert_post to work
- mysql query from wordpress page using custom table
- Importing Geo data into wordpress database
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- How to check if a meta value has already been assigned to any user?
- Blog posts repeat
- Checkbox doesn’t stay checked, conten
- Not connecting to database in file with multiple MySQL connections
- Way to bulk make all my tags lowercase?
- $Wpdb post meta query is not working with mutliple meta keys and values? [closed]
- List posts that don’t have a specific tag?
- WP_Query fails despite having 1 post
- Add content after the first post in WP Loop
- Loop stopped working
- Display an image if odd number of posts in grid
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- php include not working in custom page
- Is the 404 page automatically displayed if a loop returns nothing?
- email alert for product availability
- How to pass a variable to get_template_part that’s updated every time the template part is called?
- use loop to return blog details
- How to add post meta in while loop?
- How do I prepare strings for insertions as values into a MySQL table?
- Calling function in loop causes repeat data
- add category to posts with tag wordpress
- How can I Use 2 databases with one WordPress install
- How to Generate a list of Most Commented post?
- Why won’t this wpdb get_results query return results?
- How to pick “full/thumbnail” images in the loop?
- mySQL queries are executed twice on wordpress website
- How to Fix an Archive.php That Displays All Posts?
- How to add ASCII symbol after each recent post [closed]
- Search.php gets metadata from first post
- Most viewed posts in WordPress
- the_post(); prints out style text into my HTML?
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- WordPress low speed after migrating to new host
- AWS Lightsail WordPress – connect to database on instance using mysqli
- call to undefined function mysql_connect
- Using wpdb to connect to a different database is not working
- How to edit content in WordPress and the Polylang – plugin? – with demosite
- Accordion headings cuts off to second line on collapsing a accordion heading (used acf repeater)
- WordPress Recent Posts – Loop
- ACF background-color per post in a WordPress loop
- Advertisement in Loop Posts wordpress
- Insert data from form to database
- Date of last blog update for specific authors only?
- Prepared DB Query from _POST array
- Adding custom PHP to existing loop in Genesis
- How to Pass Current Taxonomy Terms into new WP_Query?
- Loop returns more items than exist?
- Conditional statement within WP SQL query
- Modify category archive page loop on functions.php
- WP_Post is not from correct array
- Post formating on Home page
- divide custom field values in div every two values
- WordPress upload images not displaying
- two wordpress sites, two themes, one database, same content
- how to check for wordpress Query errors
- Limit ads appearing more than three times
- Pagination on Custom Loop
- MySQL database migration to WordPress
- Custom single.php files for different post formats
- Custom query_posts() parameter
- Troubleshooting “loopback requests that take too long”
- How to edit the default database of WordPress [closed]
- Query Concatenation
- Help with if/else loop [closed]
- Display total count of products in orders of a specific order status
- Can’t insert into a database wordpress
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress