Well it wasn’t too hard after some perspective.
public function get_adjacent_post_mod($where){
if (is_single()){
global $wpdb, $post;
if ( get_post_status ( ) == 'private' ) {
$where = str_replace( "AND ( p.post_status="publish" OR p.post_status="private" )", "AND p.post_status="private"", $where );
return $where;
} else {
$where = str_replace( "AND ( p.post_status="publish" OR p.post_status="private" )", "AND p.post_status="publish"", $where );
return $where;
}
}
}
Related Posts:
- Version upgrade: can my plugin filter the SQL statements issued during a database upgrade?
- Getting wrong relationship value in $args in wp_Query?
- How is the data stored in the database?
- How to modify post content before writing to database?
- Actions or filters fired when data is saved in a custom table
- Activation hook not creating table
- Is the usage of ON DELETE CASCADE wrong or not allowed on wordpress?
- WordPress database error for query INSERT INTO
- How to connect to AWS RDS external database (not for the core WordPress db)
- How to get all queries’s results after they have executed?
- Alternative functions for mysql_free_result and mysql_ping in wordpress functions
- Using AND and bracket grouping in SQL not working
- Two different wordpress sites – same server and IP address. Gaining Access to database 1 of 2
- What might be the reason of Couldn’t fetch mysqli_result on another domain?
- WordPress database error: [Query was empty] – using $wpdb->prepare()
- WordPress how do I echo SUM from a column of a MySQL table by user id AND type_operation
- WordPress doesn’t create table on plugin activation
- pull data from wordpress database
- Default table collation on plugin activation?
- Using query_vars filter
- Is it possible to remove next-post / previous-post with out creating a custom template?
- How do I Make a Theme “plugin-ready”?
- How to get data from WordPress $wpdb into React Gutenberg Blocks Frontend?
- What is the added “complexity” of custom tables?
- Display only certain posts based on visitor’s country?
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Conditional add_filter?
- Is it possible to create an action hook using do_action() within add_action()?
- Calling apply_filters on non-documented hooks
- How to allow Unfiltered HTML in a wordpress multisite install
- Is there a way to verified if an add_filter is already applied?
- Passing array of strings to a SQL statement in a WordPress plugin
- multiple functions with same filter
- Woocommerce – Hide a Column in Cart Table
- What for the tables ending with the meta used in database of wordpress?
- Creating table with plugin is not working
- query users by role
- add_filter : Passing an array instead of the callback function?
- Order by custom table and multiplication
- How to Create database table when Plugin installed/activated, and delete database when Plugin deleted
- Namespaced action and filter tags
- Is there a Filter that I can use to filter the tags before they are inserted in to the database?
- WordPress is automatically linking plain text email addresses
- I’m designing a plugin to create database indexes. Suggestions?
- Are there any scripts, classes, and/or functions built-in to WP for a plugin to export/import its saved data from wp_options?
- Why doesn’t my simple the_title filter get applied?
- Strange issue saving custom field data for a WooCommerce order
- Prefixing plugin hooks (actions/filters) with a wrapper class or functions
- Form doesnt save to database
- Updating Woocommerce Settings API when WordPress Settings API saved and vise versa
- Can’t get woocommerce_get_price_html to work [closed]
- Update results, Before deleting the related category [closed]
- Search and Filter
- Is using custom table to suit business needs instead of transients a big hit to page load speed?
- How to add user details to different tables immediately after user registration
- WordPress custom taxonomy check box to dropdown
- mysql_real_escape_string() vs. esc_sql() in WordPress
- Optimising a big WordPress site
- What is the best way to store a few fields?
- Delete data from database using row action
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- Remove an action by extending class and replacing it
- wpdb prepare insert table doesn’t work
- Make Database query only when option is updated
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Brainstorm – Slow Query from Plugin Need to Speed It Up
- How do I debug an error that a plugin is causing?
- WP_NAV_MENU filter targets all menus
- Update plugin settings option_name for big plugin update
- What could cause a WP Option to get truncated?
- select a single val though a table in wordpress
- Integrating Custom Database with WordPress
- Is there an action_filter hook to add content before the post title?
- How to display results from a data table with an encrypted user id?
- Adding tables to dashboard pages programmatically?
- Error code when migrate
- How to get inserted row IDs for bulk/batch insert with wpdb query?
- Use admin-post to submit form data to external database
- Redirect theme directory to plugin theme directory
- Save in my custom admin page and redirect to the saved object
- WordPress Reset password Strength set to medium
- Change Front page displays settings conditionally when user is online
- How to store in the database directly the translation?
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- Single_template for a custom post type created from a plugin is returning an empty page
- sql query not working in wp plugin
- $wpdb Mysql trigger problem
- Confusing $tag specification for apply_filters call, in core options.php code
- Ajax not working to insert, query and result data
- Custom MySQL query to pull out Advanced Custom Fields?
- Associating special meaning with user id 0
- WordPress permalink setting
- What method should I use to store my plugin data (multi level menus with options on each item)
- How to add additional field in a table row after creating a table?
- WordPress plugin tables become corrupt
- Nothing happens on WordPress Update command
- append code after the_content not working
- How can I delete the options from DB when the plugin is deleted?
- Custom database table entry edit page
- How to get list of ALL tables in the database?