Skip to content

Instantly share code, notes, and snippets.

WordPress Channel wpchannel

Block or report user

Report or block wpchannel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Jason-Murray
Jason-Murray / functions.php
Last active Jun 28, 2019
Adds all "visible" custom fields to the custom search excerpt for Relevanssi, code is based on the indexing code used in Relevanssi to add these fields to the index.
View functions.php
// Relevanssi add content to custom excerpts.
add_filter('relevanssi_excerpt_content', 'custom_fields_to_excerpts', 10, 3);
function custom_fields_to_excerpts($content, $post, $query) {
$custom_fields = get_post_custom_keys($post->ID);
$remove_underscore_fields = true;
if (is_array($custom_fields)) {
$custom_fields = array_unique($custom_fields); // no reason to index duplicates
foreach ($custom_fields as $field) {
@thierrypigot
thierrypigot / bcpj_query_exclude_offre_id.php
Created May 19, 2015
ACF : Exclude current post/page/cpt from relationship field results
View bcpj_query_exclude_offre_id.php
<?php
/**
* Exclude current post/page/cpt from relationship field results
*/
add_filter('acf/fields/relationship/query/name=NAME-OF-THE-FIELD', 'bcpj_query_exclude_offre_id', 10, 3);
function bcpj_query_exclude_offre_id( $options, $field, $the_post )
{
if( is_admin() )
{
$options['post__not_in'] = array( $the_post->ID );
@Zodiac1978
Zodiac1978 / .htaccess
Last active Sep 15, 2019
Safer WordPress with these .htaccess additions
View .htaccess
# Don't show errors which contain full path diclosure (FPD)
# Use that line only if PHP is installed as a module and not per CGI
# try using a php.ini in that case.
# Change mod_php5.c to mod_php7.c if you are running PHP7
<IfModule mod_php5.c>
php_flag display_errors Off
</IfModule>
# Don't list directories
<IfModule mod_autoindex.c>
You can’t perform that action at this time.