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?
- Post meta vs separate database tables
- How to create an API for my plugin?
- Update Option Stored in Multi-Dimensional Array
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Using a database view = evil incarnate?
- How does WordPress handle MySQL row lock errors?
- WordPress and multithreading
- Explanation of the “posts_join” and “posts_fields” filter hooks?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- How Can I Add a Filter to Class Instance Only?
- function triggered by “manage_users_custom_column” filter not working
- Proper way to use apply_filters() with class functions?
- add_filter and remove_filter added before and after wp_query
- Determine which theme location a wp_get_nav_menu_items is for
- What’s the difference between hooks, filters and actions? [duplicate]
- WordPress Media mime type filter problem 4.0
- Sample — test — data for large WordPress install
- Is there any reason only 1 (my) IP would be added to this table using $wpdn->insert?
- How to add custom content under plugin row in WordPress admin plugin list?
- How to store data for posts/pages built with drag-n-drop builder?
- Define a function outside a class and call the function using action or filter hook
- How can I free up the memory used by update_post_meta?
- Does add_filter work outside functions.php
- Synchronize Custom post type tags to WordPress default posts tags
- Saving data from block editor to the database
- $wpdb -> Batch insert from XML File?
- dbDelta() Error – Incorrect index name ” for query ALTER TABLE
- Update/insert only a column of database table
- get_current_screen() return null
- Problems with: manage_${post_type}_posts_columns
- Add code inside specific wordpress standard function
- Using WPDB to output raw XML fails because of wp-blog-header.php
- Help With MySQL to WPDB Query Conversion
- How to filter the_content() & include content from template
- Plugin Development for registered users
- wpdb->prepare and mysql UPDATE – how is it done?
- dbDelta SQL Query Not Working
- dbDelta not installing database
- Plugin: database creation
- Show dynamic list of products from custom api of another database under same host
- Bind a function with its own argument to show something dynamically after every content
- Can we intercept user_login and user_pass from a wp_login_form?
- Hook add_attachment error
- How best to handle database version dependence (from $wp_db_version)
- WP: Search and replace in DB programmatically
- Update variable value via add_filter
- Make wordpress join default user metas with a column from another table while displaying the wp_users table on the users screen
- How can I programmatically change a MySql variable (foreign_keys_check)?
- Configure WordPress to Generate Scheme-less Relative URLs
- Gravity Forms Anchor only on Front Page?
- How to find list of all functions bind to a particular hook from my plugin?
- Plugin Development: Storing and Manipulating Data That Fits JSON in Database
- $wpdb->prepare is not working like mysql_real_escape_string
- Save temporary registration data
- How to validate inputs with filter in register_setting callback
- Can / should a widget plugin define its own Widget Area?
- Foreign wp_users ID in custom plugin DB table?
- How to Get Last ID?
- add_filter postbox_classes multiple post types
- Override category archive page title (not the head title)
- Insert, update or remove data from database (usermeta)
- Override woocommerce loop-start.php from theme using plugin?
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- Relational / Associate tables using native WordPress functionality
- Update database record in plugin
- Add_action not calling callback function
- I have a plugin where in I have to change the title of the page dynamically by sending parameter to the_title filter
- get_comment_meta() for a filter hook in a plugin
- Plugin MySQL SELECT custom data and filter on user meta
- Caption Shortcode: what filter to change the image size?
- Hook for plugin to show content for certain urls
- Why Worpdress doesn’t create table in database?
- Form and database, plugin development
- $wpdb how can i save my postmeta table before querying it
- How do I replace title with my plugin?
- wp_mail_from not changing from address
- How to edit the default database of WordPress [closed]
- Running one-off cron jobs when WP_DISABLE_CRON is true: can I hit /wp-cron.php?
- 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]