Like so:
INSERT INTO $mytable (post_id)
SELECT ID
FROM $wpdb->posts as posts
LEFT JOIN $mytable as dup_check
ON dup_check.post_id = posts.ID
WHERE dup_check.post_id IS NULL;
Related Posts:
- Build a content and excerpt grid loop with paging and options for # of posts
- Change the footer text on the login page
- How to remove a metabox from menu editor page?
- Check if page parent has certain template
- Delete post revisions on post publish
- Hooking new functions to actions + passing parameters
- Is $hook a global variable in WordPress
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Successful or Error Message after running mysql code in functions.php
- PHP code inside shortcodes
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- Handling Body class based on Template
- WSoD being caused by this piece of code
- Logged in user ID as post ID
- How to check if a meta value has already been assigned to any user?
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Why ajax doesn’t work on certain wordpress hooks?
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- WordPress Gravatar filter is removing my custom attributes
- Error in custom php function doesn’t exist
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Return a numerical function value in Customizer controls
- Modify custom field input data before creating a new post
- how to make custom ajax handler?
- $wpdb->wp_users returning empty value for
- How to list posts from a plugin taxonomy?
- Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args
- Multiple meta_key in one global $wpdb;
- Run a code only on theme activation only during first activation
- Pagination broken on is_front_page()
- Theme not calling Jquery properly
- WordPress redirect redirecting too many times or not at all
- Why does the post_type_link hook everything twice?
- Issue with fetching mysql data and displaying results via shortcode in webpage
- How to have different site identity logos on each page on Astra Theme [closed]
- How can I hook into the wp_mail function used by BackWPup?
- change the default order of posts only for specific categories
- Get user custom field value on function.php
- How to use mysql LIKE with wpdb?
- Adding function to child theme’s function.php
- Must filter functions receive all arguments passed to them?
- Creating customized php files in theme folder
- Dynamically Generate Functions and Hooks
- How to pass hook variable to function?
- making php value numeric
- SQL error with custom query
- Modify WooCommerce used to get all orders in dashboard
- How do I add a function to parent theme
- Contain multiple page templates in one PHP custom template file in WordPress?
- Wp_Schedule_Event every few minutes doesn’t work
- Adding custom field to product category and show it to shop/category shop page
- Custom meta box is not displaying value showing tag as empty
- Discount in the specific product title using keyword ( Woocoommerce )
- How do I get the value of a current user’s custom field?
- Hook into all password resets in WordPress and get password before hashing?
- Getting page / post URL on publish and / or update
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Why transition_post_type hook is called twice for the same post?
- How can I display a query in a page?
- How to set up an auto delete post?
- WordPress HTML Helper
- Custom query_posts() parameter
- How to modify this function to exclude also the post belonging to a specific category?
- Assign new post author IF another user in custom field on post transition
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- transition_post_status hook, works – but not if the post is new
- /page/2/ redirect to 404
- Is there a hook that I can use when a fatal error occurs?
- Can’t load WP function into external function
- Stumped on migration
- Count the number of times the search form template gets included on a page
- Is there a way to get 3+ dimensional array from a single MySql command
- Custom Plugin For Converting CSV To MySQL
- Limiting woocommerce line_total decimal length
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Run a filter when a walker runs
- How can I use wp_insert_comment to write a comment when a post is edited?
- How to add a second ‘place order’ button in WooCommerce [closed]
- Using Multiple Submit buttons to trigger customised php functions
- Removing unneccessary p-tags (Not every p)
- How to remove the excerpt in the Dzonia Lite theme
- comments_number display outside specified span
- Choose To Display Post Views With An Options Panel
- Prevent Data Resubmission On Page refresh
- Set WordPress Default Template
- Working with query_posts ( arrays and query strings)
- Shortcode content filter?
- Why is variable not working on custom sql query using wpdb?
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- How do I display a user’s previous orders as a select box option on a product?
- Using file_get_contents with Gravity Forms uploads folder to create images in the media library returning false
- Can’t search posts using WP_QUERY inside AJAX Function
- allow subscribers to see private posts without plug in
- Show MySQL errors that occur when I excute $wpdb->insert()
- Replace word in “the_content” only for index.php
- How do you add customer capability after Woocommerce purchase?
- Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce
- How to get specific image in media library with php
- Function set default image when image not present