Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-inclu...
File: link-template.php
[1500] Fix | Delete
/**
[1501] Fix | Delete
* Displays the edit post link for post.
[1502] Fix | Delete
*
[1503] Fix | Delete
* @since 1.0.0
[1504] Fix | Delete
* @since 4.4.0 The `$css_class` argument was added.
[1505] Fix | Delete
*
[1506] Fix | Delete
* @param string $text Optional. Anchor text. If null, default is 'Edit This'. Default null.
[1507] Fix | Delete
* @param string $before Optional. Display before edit link. Default empty.
[1508] Fix | Delete
* @param string $after Optional. Display after edit link. Default empty.
[1509] Fix | Delete
* @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`.
[1510] Fix | Delete
* @param string $css_class Optional. Add custom class to link. Default 'post-edit-link'.
[1511] Fix | Delete
*/
[1512] Fix | Delete
function edit_post_link( $text = null, $before = '', $after = '', $post = 0, $css_class = 'post-edit-link' ) {
[1513] Fix | Delete
$post = get_post( $post );
[1514] Fix | Delete
[1515] Fix | Delete
if ( ! $post ) {
[1516] Fix | Delete
return;
[1517] Fix | Delete
}
[1518] Fix | Delete
[1519] Fix | Delete
$url = get_edit_post_link( $post->ID );
[1520] Fix | Delete
[1521] Fix | Delete
if ( ! $url ) {
[1522] Fix | Delete
return;
[1523] Fix | Delete
}
[1524] Fix | Delete
[1525] Fix | Delete
if ( null === $text ) {
[1526] Fix | Delete
$text = __( 'Edit This' );
[1527] Fix | Delete
}
[1528] Fix | Delete
[1529] Fix | Delete
$link = '<a class="' . esc_attr( $css_class ) . '" href="' . esc_url( $url ) . '">' . $text . '</a>';
[1530] Fix | Delete
[1531] Fix | Delete
/**
[1532] Fix | Delete
* Filters the post edit link anchor tag.
[1533] Fix | Delete
*
[1534] Fix | Delete
* @since 2.3.0
[1535] Fix | Delete
*
[1536] Fix | Delete
* @param string $link Anchor tag for the edit link.
[1537] Fix | Delete
* @param int $post_id Post ID.
[1538] Fix | Delete
* @param string $text Anchor text.
[1539] Fix | Delete
*/
[1540] Fix | Delete
echo $before . apply_filters( 'edit_post_link', $link, $post->ID, $text ) . $after;
[1541] Fix | Delete
}
[1542] Fix | Delete
[1543] Fix | Delete
/**
[1544] Fix | Delete
* Retrieves the delete posts link for post.
[1545] Fix | Delete
*
[1546] Fix | Delete
* Can be used within the WordPress loop or outside of it, with any post type.
[1547] Fix | Delete
*
[1548] Fix | Delete
* @since 2.9.0
[1549] Fix | Delete
*
[1550] Fix | Delete
* @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`.
[1551] Fix | Delete
* @param string $deprecated Not used.
[1552] Fix | Delete
* @param bool $force_delete Optional. Whether to bypass Trash and force deletion. Default false.
[1553] Fix | Delete
* @return string|void The delete post link URL for the given post.
[1554] Fix | Delete
*/
[1555] Fix | Delete
function get_delete_post_link( $post = 0, $deprecated = '', $force_delete = false ) {
[1556] Fix | Delete
if ( ! empty( $deprecated ) ) {
[1557] Fix | Delete
_deprecated_argument( __FUNCTION__, '3.0.0' );
[1558] Fix | Delete
}
[1559] Fix | Delete
[1560] Fix | Delete
$post = get_post( $post );
[1561] Fix | Delete
[1562] Fix | Delete
if ( ! $post ) {
[1563] Fix | Delete
return;
[1564] Fix | Delete
}
[1565] Fix | Delete
[1566] Fix | Delete
$post_type_object = get_post_type_object( $post->post_type );
[1567] Fix | Delete
[1568] Fix | Delete
if ( ! $post_type_object ) {
[1569] Fix | Delete
return;
[1570] Fix | Delete
}
[1571] Fix | Delete
[1572] Fix | Delete
if ( ! current_user_can( 'delete_post', $post->ID ) ) {
[1573] Fix | Delete
return;
[1574] Fix | Delete
}
[1575] Fix | Delete
[1576] Fix | Delete
$action = ( $force_delete || ! EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
[1577] Fix | Delete
[1578] Fix | Delete
$delete_link = add_query_arg( 'action', $action, admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) );
[1579] Fix | Delete
[1580] Fix | Delete
/**
[1581] Fix | Delete
* Filters the post delete link.
[1582] Fix | Delete
*
[1583] Fix | Delete
* @since 2.9.0
[1584] Fix | Delete
*
[1585] Fix | Delete
* @param string $link The delete link.
[1586] Fix | Delete
* @param int $post_id Post ID.
[1587] Fix | Delete
* @param bool $force_delete Whether to bypass the Trash and force deletion. Default false.
[1588] Fix | Delete
*/
[1589] Fix | Delete
return apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-post_{$post->ID}" ), $post->ID, $force_delete );
[1590] Fix | Delete
}
[1591] Fix | Delete
[1592] Fix | Delete
/**
[1593] Fix | Delete
* Retrieves the edit comment link.
[1594] Fix | Delete
*
[1595] Fix | Delete
* @since 2.3.0
[1596] Fix | Delete
*
[1597] Fix | Delete
* @param int|WP_Comment $comment_id Optional. Comment ID or WP_Comment object.
[1598] Fix | Delete
* @return string|void The edit comment link URL for the given comment.
[1599] Fix | Delete
*/
[1600] Fix | Delete
function get_edit_comment_link( $comment_id = 0 ) {
[1601] Fix | Delete
$comment = get_comment( $comment_id );
[1602] Fix | Delete
[1603] Fix | Delete
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
[1604] Fix | Delete
return;
[1605] Fix | Delete
}
[1606] Fix | Delete
[1607] Fix | Delete
$location = admin_url( 'comment.php?action=editcomment&amp;c=' ) . $comment->comment_ID;
[1608] Fix | Delete
[1609] Fix | Delete
/**
[1610] Fix | Delete
* Filters the comment edit link.
[1611] Fix | Delete
*
[1612] Fix | Delete
* @since 2.3.0
[1613] Fix | Delete
*
[1614] Fix | Delete
* @param string $location The edit link.
[1615] Fix | Delete
*/
[1616] Fix | Delete
return apply_filters( 'get_edit_comment_link', $location );
[1617] Fix | Delete
}
[1618] Fix | Delete
[1619] Fix | Delete
/**
[1620] Fix | Delete
* Displays the edit comment link with formatting.
[1621] Fix | Delete
*
[1622] Fix | Delete
* @since 1.0.0
[1623] Fix | Delete
*
[1624] Fix | Delete
* @param string $text Optional. Anchor text. If null, default is 'Edit This'. Default null.
[1625] Fix | Delete
* @param string $before Optional. Display before edit link. Default empty.
[1626] Fix | Delete
* @param string $after Optional. Display after edit link. Default empty.
[1627] Fix | Delete
*/
[1628] Fix | Delete
function edit_comment_link( $text = null, $before = '', $after = '' ) {
[1629] Fix | Delete
$comment = get_comment();
[1630] Fix | Delete
[1631] Fix | Delete
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
[1632] Fix | Delete
return;
[1633] Fix | Delete
}
[1634] Fix | Delete
[1635] Fix | Delete
if ( null === $text ) {
[1636] Fix | Delete
$text = __( 'Edit This' );
[1637] Fix | Delete
}
[1638] Fix | Delete
[1639] Fix | Delete
$link = '<a class="comment-edit-link" href="' . esc_url( get_edit_comment_link( $comment ) ) . '">' . $text . '</a>';
[1640] Fix | Delete
[1641] Fix | Delete
/**
[1642] Fix | Delete
* Filters the comment edit link anchor tag.
[1643] Fix | Delete
*
[1644] Fix | Delete
* @since 2.3.0
[1645] Fix | Delete
*
[1646] Fix | Delete
* @param string $link Anchor tag for the edit link.
[1647] Fix | Delete
* @param string $comment_id Comment ID as a numeric string.
[1648] Fix | Delete
* @param string $text Anchor text.
[1649] Fix | Delete
*/
[1650] Fix | Delete
echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after;
[1651] Fix | Delete
}
[1652] Fix | Delete
[1653] Fix | Delete
/**
[1654] Fix | Delete
* Displays the edit bookmark link.
[1655] Fix | Delete
*
[1656] Fix | Delete
* @since 2.7.0
[1657] Fix | Delete
*
[1658] Fix | Delete
* @param int|stdClass $link Optional. Bookmark ID. Default is the ID of the current bookmark.
[1659] Fix | Delete
* @return string|void The edit bookmark link URL.
[1660] Fix | Delete
*/
[1661] Fix | Delete
function get_edit_bookmark_link( $link = 0 ) {
[1662] Fix | Delete
$link = get_bookmark( $link );
[1663] Fix | Delete
[1664] Fix | Delete
if ( ! current_user_can( 'manage_links' ) ) {
[1665] Fix | Delete
return;
[1666] Fix | Delete
}
[1667] Fix | Delete
[1668] Fix | Delete
$location = admin_url( 'link.php?action=edit&amp;link_id=' ) . $link->link_id;
[1669] Fix | Delete
[1670] Fix | Delete
/**
[1671] Fix | Delete
* Filters the bookmark edit link.
[1672] Fix | Delete
*
[1673] Fix | Delete
* @since 2.7.0
[1674] Fix | Delete
*
[1675] Fix | Delete
* @param string $location The edit link.
[1676] Fix | Delete
* @param int $link_id Bookmark ID.
[1677] Fix | Delete
*/
[1678] Fix | Delete
return apply_filters( 'get_edit_bookmark_link', $location, $link->link_id );
[1679] Fix | Delete
}
[1680] Fix | Delete
[1681] Fix | Delete
/**
[1682] Fix | Delete
* Displays the edit bookmark link anchor content.
[1683] Fix | Delete
*
[1684] Fix | Delete
* @since 2.7.0
[1685] Fix | Delete
*
[1686] Fix | Delete
* @param string $link Optional. Anchor text. If empty, default is 'Edit This'. Default empty.
[1687] Fix | Delete
* @param string $before Optional. Display before edit link. Default empty.
[1688] Fix | Delete
* @param string $after Optional. Display after edit link. Default empty.
[1689] Fix | Delete
* @param int $bookmark Optional. Bookmark ID. Default is the current bookmark.
[1690] Fix | Delete
*/
[1691] Fix | Delete
function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) {
[1692] Fix | Delete
$bookmark = get_bookmark( $bookmark );
[1693] Fix | Delete
[1694] Fix | Delete
if ( ! current_user_can( 'manage_links' ) ) {
[1695] Fix | Delete
return;
[1696] Fix | Delete
}
[1697] Fix | Delete
[1698] Fix | Delete
if ( empty( $link ) ) {
[1699] Fix | Delete
$link = __( 'Edit This' );
[1700] Fix | Delete
}
[1701] Fix | Delete
[1702] Fix | Delete
$link = '<a href="' . esc_url( get_edit_bookmark_link( $bookmark ) ) . '">' . $link . '</a>';
[1703] Fix | Delete
[1704] Fix | Delete
/**
[1705] Fix | Delete
* Filters the bookmark edit link anchor tag.
[1706] Fix | Delete
*
[1707] Fix | Delete
* @since 2.7.0
[1708] Fix | Delete
*
[1709] Fix | Delete
* @param string $link Anchor tag for the edit link.
[1710] Fix | Delete
* @param int $link_id Bookmark ID.
[1711] Fix | Delete
*/
[1712] Fix | Delete
echo $before . apply_filters( 'edit_bookmark_link', $link, $bookmark->link_id ) . $after;
[1713] Fix | Delete
}
[1714] Fix | Delete
[1715] Fix | Delete
/**
[1716] Fix | Delete
* Retrieves the edit user link.
[1717] Fix | Delete
*
[1718] Fix | Delete
* @since 3.5.0
[1719] Fix | Delete
*
[1720] Fix | Delete
* @param int $user_id Optional. User ID. Defaults to the current user.
[1721] Fix | Delete
* @return string URL to edit user page or empty string.
[1722] Fix | Delete
*/
[1723] Fix | Delete
function get_edit_user_link( $user_id = null ) {
[1724] Fix | Delete
if ( ! $user_id ) {
[1725] Fix | Delete
$user_id = get_current_user_id();
[1726] Fix | Delete
}
[1727] Fix | Delete
[1728] Fix | Delete
if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) ) {
[1729] Fix | Delete
return '';
[1730] Fix | Delete
}
[1731] Fix | Delete
[1732] Fix | Delete
$user = get_userdata( $user_id );
[1733] Fix | Delete
[1734] Fix | Delete
if ( ! $user ) {
[1735] Fix | Delete
return '';
[1736] Fix | Delete
}
[1737] Fix | Delete
[1738] Fix | Delete
if ( get_current_user_id() === $user->ID ) {
[1739] Fix | Delete
$link = get_edit_profile_url( $user->ID );
[1740] Fix | Delete
} else {
[1741] Fix | Delete
$link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
[1742] Fix | Delete
}
[1743] Fix | Delete
[1744] Fix | Delete
/**
[1745] Fix | Delete
* Filters the user edit link.
[1746] Fix | Delete
*
[1747] Fix | Delete
* @since 3.5.0
[1748] Fix | Delete
*
[1749] Fix | Delete
* @param string $link The edit link.
[1750] Fix | Delete
* @param int $user_id User ID.
[1751] Fix | Delete
*/
[1752] Fix | Delete
return apply_filters( 'get_edit_user_link', $link, $user->ID );
[1753] Fix | Delete
}
[1754] Fix | Delete
[1755] Fix | Delete
//
[1756] Fix | Delete
// Navigation links.
[1757] Fix | Delete
//
[1758] Fix | Delete
[1759] Fix | Delete
/**
[1760] Fix | Delete
* Retrieves the previous post that is adjacent to the current post.
[1761] Fix | Delete
*
[1762] Fix | Delete
* @since 1.5.0
[1763] Fix | Delete
*
[1764] Fix | Delete
* @param bool $in_same_term Optional. Whether post should be in the same taxonomy term.
[1765] Fix | Delete
* Default false.
[1766] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[1767] Fix | Delete
* Default empty.
[1768] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[1769] Fix | Delete
* @return WP_Post|null|string Post object if successful. Null if global `$post` is not set.
[1770] Fix | Delete
* Empty string if no corresponding post exists.
[1771] Fix | Delete
*/
[1772] Fix | Delete
function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
[1773] Fix | Delete
return get_adjacent_post( $in_same_term, $excluded_terms, true, $taxonomy );
[1774] Fix | Delete
}
[1775] Fix | Delete
[1776] Fix | Delete
/**
[1777] Fix | Delete
* Retrieves the next post that is adjacent to the current post.
[1778] Fix | Delete
*
[1779] Fix | Delete
* @since 1.5.0
[1780] Fix | Delete
*
[1781] Fix | Delete
* @param bool $in_same_term Optional. Whether post should be in the same taxonomy term.
[1782] Fix | Delete
* Default false.
[1783] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[1784] Fix | Delete
* Default empty.
[1785] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[1786] Fix | Delete
* @return WP_Post|null|string Post object if successful. Null if global `$post` is not set.
[1787] Fix | Delete
* Empty string if no corresponding post exists.
[1788] Fix | Delete
*/
[1789] Fix | Delete
function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
[1790] Fix | Delete
return get_adjacent_post( $in_same_term, $excluded_terms, false, $taxonomy );
[1791] Fix | Delete
}
[1792] Fix | Delete
[1793] Fix | Delete
/**
[1794] Fix | Delete
* Retrieves the adjacent post.
[1795] Fix | Delete
*
[1796] Fix | Delete
* Can either be next or previous post.
[1797] Fix | Delete
*
[1798] Fix | Delete
* @since 2.5.0
[1799] Fix | Delete
*
[1800] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[1801] Fix | Delete
*
[1802] Fix | Delete
* @param bool $in_same_term Optional. Whether post should be in the same taxonomy term.
[1803] Fix | Delete
* Default false.
[1804] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[1805] Fix | Delete
* Default empty string.
[1806] Fix | Delete
* @param bool $previous Optional. Whether to retrieve previous post.
[1807] Fix | Delete
* Default true.
[1808] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[1809] Fix | Delete
* @return WP_Post|null|string Post object if successful. Null if global `$post` is not set.
[1810] Fix | Delete
* Empty string if no corresponding post exists.
[1811] Fix | Delete
*/
[1812] Fix | Delete
function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
[1813] Fix | Delete
global $wpdb;
[1814] Fix | Delete
[1815] Fix | Delete
$post = get_post();
[1816] Fix | Delete
[1817] Fix | Delete
if ( ! $post || ! taxonomy_exists( $taxonomy ) ) {
[1818] Fix | Delete
return null;
[1819] Fix | Delete
}
[1820] Fix | Delete
[1821] Fix | Delete
$current_post_date = $post->post_date;
[1822] Fix | Delete
[1823] Fix | Delete
$join = '';
[1824] Fix | Delete
$where = '';
[1825] Fix | Delete
$adjacent = $previous ? 'previous' : 'next';
[1826] Fix | Delete
[1827] Fix | Delete
if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) ) {
[1828] Fix | Delete
// Back-compat, $excluded_terms used to be $excluded_categories with IDs separated by " and ".
[1829] Fix | Delete
if ( str_contains( $excluded_terms, ' and ' ) ) {
[1830] Fix | Delete
_deprecated_argument(
[1831] Fix | Delete
__FUNCTION__,
[1832] Fix | Delete
'3.3.0',
[1833] Fix | Delete
sprintf(
[1834] Fix | Delete
/* translators: %s: The word 'and'. */
[1835] Fix | Delete
__( 'Use commas instead of %s to separate excluded terms.' ),
[1836] Fix | Delete
"'and'"
[1837] Fix | Delete
)
[1838] Fix | Delete
);
[1839] Fix | Delete
$excluded_terms = explode( ' and ', $excluded_terms );
[1840] Fix | Delete
} else {
[1841] Fix | Delete
$excluded_terms = explode( ',', $excluded_terms );
[1842] Fix | Delete
}
[1843] Fix | Delete
[1844] Fix | Delete
$excluded_terms = array_map( 'intval', $excluded_terms );
[1845] Fix | Delete
}
[1846] Fix | Delete
[1847] Fix | Delete
/**
[1848] Fix | Delete
* Filters the IDs of terms excluded from adjacent post queries.
[1849] Fix | Delete
*
[1850] Fix | Delete
* The dynamic portion of the hook name, `$adjacent`, refers to the type
[1851] Fix | Delete
* of adjacency, 'next' or 'previous'.
[1852] Fix | Delete
*
[1853] Fix | Delete
* Possible hook names include:
[1854] Fix | Delete
*
[1855] Fix | Delete
* - `get_next_post_excluded_terms`
[1856] Fix | Delete
* - `get_previous_post_excluded_terms`
[1857] Fix | Delete
*
[1858] Fix | Delete
* @since 4.4.0
[1859] Fix | Delete
*
[1860] Fix | Delete
* @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided.
[1861] Fix | Delete
*/
[1862] Fix | Delete
$excluded_terms = apply_filters( "get_{$adjacent}_post_excluded_terms", $excluded_terms );
[1863] Fix | Delete
[1864] Fix | Delete
if ( $in_same_term || ! empty( $excluded_terms ) ) {
[1865] Fix | Delete
if ( $in_same_term ) {
[1866] Fix | Delete
$join .= " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
[1867] Fix | Delete
$where .= $wpdb->prepare( 'AND tt.taxonomy = %s', $taxonomy );
[1868] Fix | Delete
[1869] Fix | Delete
if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) ) {
[1870] Fix | Delete
return '';
[1871] Fix | Delete
}
[1872] Fix | Delete
$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
[1873] Fix | Delete
[1874] Fix | Delete
// Remove any exclusions from the term array to include.
[1875] Fix | Delete
$term_array = array_diff( $term_array, (array) $excluded_terms );
[1876] Fix | Delete
$term_array = array_map( 'intval', $term_array );
[1877] Fix | Delete
[1878] Fix | Delete
if ( ! $term_array || is_wp_error( $term_array ) ) {
[1879] Fix | Delete
return '';
[1880] Fix | Delete
}
[1881] Fix | Delete
[1882] Fix | Delete
$where .= ' AND tt.term_id IN (' . implode( ',', $term_array ) . ')';
[1883] Fix | Delete
}
[1884] Fix | Delete
[1885] Fix | Delete
if ( ! empty( $excluded_terms ) ) {
[1886] Fix | Delete
$where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( ',', array_map( 'intval', $excluded_terms ) ) . ') )';
[1887] Fix | Delete
}
[1888] Fix | Delete
}
[1889] Fix | Delete
[1890] Fix | Delete
// 'post_status' clause depends on the current user.
[1891] Fix | Delete
if ( is_user_logged_in() ) {
[1892] Fix | Delete
$user_id = get_current_user_id();
[1893] Fix | Delete
[1894] Fix | Delete
$post_type_object = get_post_type_object( $post->post_type );
[1895] Fix | Delete
if ( empty( $post_type_object ) ) {
[1896] Fix | Delete
$post_type_cap = $post->post_type;
[1897] Fix | Delete
$read_private_cap = 'read_private_' . $post_type_cap . 's';
[1898] Fix | Delete
} else {
[1899] Fix | Delete
$read_private_cap = $post_type_object->cap->read_private_posts;
[1900] Fix | Delete
}
[1901] Fix | Delete
[1902] Fix | Delete
/*
[1903] Fix | Delete
* Results should include private posts belonging to the current user, or private posts where the
[1904] Fix | Delete
* current user has the 'read_private_posts' cap.
[1905] Fix | Delete
*/
[1906] Fix | Delete
$private_states = get_post_stati( array( 'private' => true ) );
[1907] Fix | Delete
$where .= " AND ( p.post_status = 'publish'";
[1908] Fix | Delete
foreach ( $private_states as $state ) {
[1909] Fix | Delete
if ( current_user_can( $read_private_cap ) ) {
[1910] Fix | Delete
$where .= $wpdb->prepare( ' OR p.post_status = %s', $state );
[1911] Fix | Delete
} else {
[1912] Fix | Delete
$where .= $wpdb->prepare( ' OR (p.post_author = %d AND p.post_status = %s)', $user_id, $state );
[1913] Fix | Delete
}
[1914] Fix | Delete
}
[1915] Fix | Delete
$where .= ' )';
[1916] Fix | Delete
} else {
[1917] Fix | Delete
$where .= " AND p.post_status = 'publish'";
[1918] Fix | Delete
}
[1919] Fix | Delete
[1920] Fix | Delete
$op = $previous ? '<' : '>';
[1921] Fix | Delete
$order = $previous ? 'DESC' : 'ASC';
[1922] Fix | Delete
[1923] Fix | Delete
/**
[1924] Fix | Delete
* Filters the JOIN clause in the SQL for an adjacent post query.
[1925] Fix | Delete
*
[1926] Fix | Delete
* The dynamic portion of the hook name, `$adjacent`, refers to the type
[1927] Fix | Delete
* of adjacency, 'next' or 'previous'.
[1928] Fix | Delete
*
[1929] Fix | Delete
* Possible hook names include:
[1930] Fix | Delete
*
[1931] Fix | Delete
* - `get_next_post_join`
[1932] Fix | Delete
* - `get_previous_post_join`
[1933] Fix | Delete
*
[1934] Fix | Delete
* @since 2.5.0
[1935] Fix | Delete
* @since 4.4.0 Added the `$taxonomy` and `$post` parameters.
[1936] Fix | Delete
*
[1937] Fix | Delete
* @param string $join The JOIN clause in the SQL.
[1938] Fix | Delete
* @param bool $in_same_term Whether post should be in the same taxonomy term.
[1939] Fix | Delete
* @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided.
[1940] Fix | Delete
* @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true.
[1941] Fix | Delete
* @param WP_Post $post WP_Post object.
[1942] Fix | Delete
*/
[1943] Fix | Delete
$join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post );
[1944] Fix | Delete
[1945] Fix | Delete
/**
[1946] Fix | Delete
* Filters the WHERE clause in the SQL for an adjacent post query.
[1947] Fix | Delete
*
[1948] Fix | Delete
* The dynamic portion of the hook name, `$adjacent`, refers to the type
[1949] Fix | Delete
* of adjacency, 'next' or 'previous'.
[1950] Fix | Delete
*
[1951] Fix | Delete
* Possible hook names include:
[1952] Fix | Delete
*
[1953] Fix | Delete
* - `get_next_post_where`
[1954] Fix | Delete
* - `get_previous_post_where`
[1955] Fix | Delete
*
[1956] Fix | Delete
* @since 2.5.0
[1957] Fix | Delete
* @since 4.4.0 Added the `$taxonomy` and `$post` parameters.
[1958] Fix | Delete
*
[1959] Fix | Delete
* @param string $where The `WHERE` clause in the SQL.
[1960] Fix | Delete
* @param bool $in_same_term Whether post should be in the same taxonomy term.
[1961] Fix | Delete
* @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided.
[1962] Fix | Delete
* @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true.
[1963] Fix | Delete
* @param WP_Post $post WP_Post object.
[1964] Fix | Delete
*/
[1965] Fix | Delete
$where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms, $taxonomy, $post );
[1966] Fix | Delete
[1967] Fix | Delete
/**
[1968] Fix | Delete
* Filters the ORDER BY clause in the SQL for an adjacent post query.
[1969] Fix | Delete
*
[1970] Fix | Delete
* The dynamic portion of the hook name, `$adjacent`, refers to the type
[1971] Fix | Delete
* of adjacency, 'next' or 'previous'.
[1972] Fix | Delete
*
[1973] Fix | Delete
* Possible hook names include:
[1974] Fix | Delete
*
[1975] Fix | Delete
* - `get_next_post_sort`
[1976] Fix | Delete
* - `get_previous_post_sort`
[1977] Fix | Delete
*
[1978] Fix | Delete
* @since 2.5.0
[1979] Fix | Delete
* @since 4.4.0 Added the `$post` parameter.
[1980] Fix | Delete
* @since 4.9.0 Added the `$order` parameter.
[1981] Fix | Delete
*
[1982] Fix | Delete
* @param string $order_by The `ORDER BY` clause in the SQL.
[1983] Fix | Delete
* @param WP_Post $post WP_Post object.
[1984] Fix | Delete
* @param string $order Sort order. 'DESC' for previous post, 'ASC' for next.
[1985] Fix | Delete
*/
[1986] Fix | Delete
$sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post, $order );
[1987] Fix | Delete
[1988] Fix | Delete
$query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort";
[1989] Fix | Delete
$key = md5( $query );
[1990] Fix | Delete
$last_changed = wp_cache_get_last_changed( 'posts' );
[1991] Fix | Delete
if ( $in_same_term || ! empty( $excluded_terms ) ) {
[1992] Fix | Delete
$last_changed .= wp_cache_get_last_changed( 'terms' );
[1993] Fix | Delete
}
[1994] Fix | Delete
$cache_key = "adjacent_post:$key:$last_changed";
[1995] Fix | Delete
[1996] Fix | Delete
$result = wp_cache_get( $cache_key, 'post-queries' );
[1997] Fix | Delete
if ( false !== $result ) {
[1998] Fix | Delete
if ( $result ) {
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function