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?
- Fatal error: Call to undefined function mysql_connect()
- How to Add Image to WordPress RSS-Feed with no Plug-in?
- How to add active class to custom menu using while loop and wp_list_pages
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- WooCommerce – Display variation custom field value [closed]
- Woocommerce HTML email option unavailable
- Use template for posts with a particular category grandparent
- WordPress Redirect: Default Password Reset URL [duplicate]
- Remove an action hook within a Class
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Add .htm extention to a custom taxonomy
- Custom gallery in wp3.5
- How to use theme function in post/page?
- esc_url( ) won’t use https
- Use post ID in functions.php file adminside
- How can I count ACF sub_field with a certain value
- Custom posts password protect
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- Woocommerce – Exclude variation attribute on specific variation
- call to undefined function mysql_connect
- Show data obtained from a function and place it in a shortocode function
- Delete empty title_tags, find a h1 heading and echo it
- WP_Query To Display Product Of Brand On Taxonomy Page
- Search for images that width and height is more than 500
- wordpress ajax return 0
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Overwriting a Shortcode
- MySQL database migration to WordPress
- What is the wrong with this function to enqueue the scripts and styles to the theme? [closed]
- Putting form result in my database
- How can I update a value of a field depending on outside source?