I found the answer to my own question. I am leaving this here in case anyone else runs into the same issues. Basically, post_exists() wants detecting duplicate posts because I didn’t put a file path for it.
I needed to include within the function.
require_once ABSPATH . '/wp-admin/includes/post.php';
Related Posts:
- Fatal error: Call to undefined function plugin_dir_path()
- Dynamic URL to reference custom PHP files
- How to correct schedule my event weekly with wp_schedule_event()
- Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions
- Disable External Pingacks on WordPress Posts and Only Allow ‘Self Pings’
- Custom plugin issue when trying to use the shortcode twice on a page [closed]
- Using wp_get_image_editor in a standalone script
- New Plugin Review
- Does wp-cron runs all tasks scheduled at same time together or one after other?
- Making Quote Plugin more efficient
- How to access function from outside of a class within this class in WP plugin?
- PHP can I add line numbers to file_get_contents()
- Adding Default Settings to Theme My Login plugin
- Swapping wp_dropdown_categories function with wp_category_checklist
- How to access global variable $menu inside a class function
- How can I remove a function that has been added to wordpress with add_filter?
- what is the best practice to add new field to an api route
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- How to call plugin function per site in a multisite?
- WP CRON duplicate wp_insert_post with has < and > tag
- How wp-cron can run in background if PHP is single threaded?
- WordPress Custom field Colors
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- How to use html inside a functions.php code?
- Plugin Generate Unexpected output during activation
- Using data sent via AJAX in multiple functions on a WP plugin
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- Scheduling an event inside plugin class is not working
- Custom meta box values are not getting saved for my custom post type
- how to save checkbox data for custom setting?
- How to Schedule Cronjobs for start of every month and year
- Call to undefined function error in plugin
- Execute Jquery when a specific page in my plugin is loading
- send popup after wp_redirect()
- Can/should we delete wordpress cron jobs with no action?
- Using ACF Relationship field to set post type to draft or published status
- How to change basename url for wp-admin?
- How to Send Pingbacks for all Posts in WordPress?
- Reliable way to add nonce to HTTP Header in WordPress?
- Only the first image uploads
- Add Pre-Defined Value to Click Counter in WordPress
- Illegal string offset checkbox
- ssl redirect function is not working
- Custom plugin: how do I call a PHP file if settings option is set to true?
- How can i avoid duplicate same post in wp?
- Display a custom name when the user has no name settle in his account
- Multiple cron jobs vs daily cron job doing multiple things? Which one yields better performance and scalability?
- In a foreach loop, how can I add a meta value if it doesn’t exist?
- How to override theme’s public static function inside of a trait?
- Enqueue sripts and styles only if function is called
- Automatically delete posts one by one depending on published time
- Taxonomy Child Term, Counter is staying on 0
- PHP get_category() function redeclared
- How to Request a User to Register on Landing at a Site, Then Automatically Delete the Users Password on Logout?
- Private messaging – Getting and displaying the avatar/url of a message recipient
- How do I routinely extract the thumbnail of the most recent post?
- Permission error on plugin save
- Break a WordPress function to run in patches and re-continue
- Trouble using wordpress functions in a pop-up modal form
- How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
- Issues separating my Plugin pages into different files
- how can I make content from a plugin hidden when user is logged in? [duplicate]
- display php code in header using wp_head()
- How do I change the Go To Categories link in the term_updated_messages
- WP Custom tables query
- Background Tasks in a WP Cronjob?
- When to use Exceptions vs Error Objects vs just plain false/null
- PHP – redirect https to http and www to non-www
- How to overwrite youtube embed?
- how to create and show sessions in word press?
- Generating add_settings_section() calls dynamically
- Query all posts of a custom taxonomy term
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- Error when adding excerpt to the content through functions.php
- Add data attribute to each li in menu
- PHP > Scheduled Tasks > Sending daily email with dynamic API variables
- Way to add captions to gallery images by code
- “Undefined index” error when saving empty array with checkboxes
- WordPress Options Page Theory Question
- How to make container class in PHP
- Any ideas why I am getting “I’m getting “wp-admin/admin-ajax.php 401 (Unauthorized)”
- Cant register rest routs from class instance
- How do I check or test a WordPress Auto Year Change Script?
- Defining multiple categories for showing latest posts
- Pagination Not Working (pages duplicating content)
- Is it possible to access admin-ajax.php using PHP?
- Trying to update Woocommerce meta values
- Hide specific shipping methode depending on day and time of day
- Adding custom field to product category and show it to shop/category shop page
- Looping through custom data in a custom table to display all items in a post
- Check if post visited first time
- Store custom field’s multiple values in one user meta key
- Custom Plugin Develoment, Form Action
- Restrict File Type Uploads by User on Wordress via functions.php
- AJAX Returning Way Too Many Posts
- add shortcode heading showing multiple time
- Select area and checkbox data is not saving?
- Suppress errors when using global function
- using a shortcode in a hyperlink