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
- Difference Between Filter and Action Hooks?
- Should I use wpdb prepare?
- Post meta vs separate database tables
- How to create an API for my plugin?
- Is it mandatory to use $wpdb->prefix in custom tables
- Update Option Stored in Multi-Dimensional Array
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- How can I load a page template from a plugin?
- Default table collation on plugin activation?
- Using query_vars filter
- Using a database view = evil incarnate?
- How does WordPress handle MySQL row lock errors?
- Writing a plugin that notify my friends of new post that mentions(@) them
- WordPress and multithreading
- How to get Post ID with the Add Filter Function
- Explanation of the “posts_join” and “posts_fields” filter hooks?
- Does using set_transient() function can lead to MySQL problems?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- add_filter OO with parameters
- How Can I Add a Filter to Class Instance Only?
- Not sure the best way to save custom plugin data
- The ideal place for storing persistent PHP objects
- Is it possible to remove next-post / previous-post with out creating a custom template?
- How do I Make a Theme “plugin-ready”?
- What is the correct way for plugins to create tables with special charset/collation considerations?
- How to remove unwanted panels inside InspectorControls from core blocks in Gutenberg
- function triggered by “manage_users_custom_column” filter not working
- Proper way to use apply_filters() with class functions?
- How to get data from WordPress $wpdb into React Gutenberg Blocks Frontend?
- I have a plugin where in I have to change the title of the page dynamically by sending parameter to the_title filter
- WordPress Dropdown image select
- Modify search form with plugin
- Organising and completing posts (mark as read and hide)
- 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
- get_comment_meta() for a filter hook in a plugin
- Plugin MySQL SELECT custom data and filter on user meta
- Which filter to use to pre-parse form elements, which are generated by plugin’s shortcode?
- sql query not working in wp plugin
- Custom signature appears twice on page
- $wpdb Mysql trigger problem
- Caption Shortcode: what filter to change the image size?
- Confusing $tag specification for apply_filters call, in core options.php code
- Ajax not working to insert, query and result data
- Hook for plugin to show content for certain urls
- Custom MySQL query to pull out Advanced Custom Fields?
- Why Worpdress doesn’t create table in database?
- Form and database, plugin development
- Associating special meaning with user id 0
- WordPress permalink setting
- $wpdb how can i save my postmeta table before querying it
- post_results filter confused by pagination in sidebar and main section
- 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
- Post data in wp-admin to external database
- How do I replace title with my plugin?
- Nothing happens on WordPress Update command
- Apply Filters Causing a 500 Internal Server Error
- wp_mail_from not changing from address
- append code after the_content not working
- add_filter adds output in the head
- How to edit the default database of WordPress [closed]
- Apply function on all action hooks?
- How can I get a plugin to hook ‘dbdelta_queries’ — a filter used during version update?
- Running one-off cron jobs when WP_DISABLE_CRON is true: can I hit /wp-cron.php?
- How can I delete the options from DB when the plugin is deleted?
- How to create a database table in WordPress using PHP
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- Can I log the searches that are returning 404 in the DB?
- Programmatically creating posts based on external JSON feed (asynchronously)
- Do Not Back Up? Is there any accepted way to tell backup and clone plugins to skip a certain file? [closed]
- WordPress database error: [Table ‘bitnami_wordpress.questions’ doesn’t exist]
- Ninja Forms: Front-End Forms, Post ID?
- Making a user platform reachable by a qr code on a pin-back-button [closed]
- multiple record insert creating many duplicate records
- Custom Plugin Breaks Other Plugin Functions
- Custom database table entry edit page
- Update Cache on Save Instead of Clearing It?
- Images stored from external API not loading
- Is there a way to force plugins to use Flyway migrations for database changes?
- Attributes array not saving values