<pre>
$terms = get_the_terms( post_id, 'taxonomy' );
if ($terms) {
foreach($terms as $term) {
wp_remove_object_terms( $line[0], $term->slug, 'taxonomy' );
}
}
</pre>
Wordpress
CF7 failed to load resource: the server responded with a status of 409 ()
<pre>
Add below code in function.php
add_filter( 'wpcf7_load_js', '__return_false' );
add_filter( 'wpcf7_load_css', '__return_false' );
</pre>
Update custom taxonomy post number limits
<pre>
function aviweb_change_posts_per_page( $query ) {
if (is_tax( 'custom_taxonomy' ) ) {
$query->set( 'posts_per_page', 3 );
}
}
add_filter( 'pre_get_posts', 'aviweb_change_posts_per_page' );
</pre>
How to get taxonomy acf data in WordPress
<pre>
$terms = get_the_terms( get_the_ID(), 'custom_taxonomy' );
<?php foreach( $terms as $term ){
$image = get_field('image', $term->taxonomy . '_' . $term->term_id);
} ?>
</pre>
How to make WordPress theme files writable
Change theme files(.css, .php) permissions to 666.
Path: wp-content/themes/active theme
Don't make everything 777 it's very risky
Owl Carousel on change event
$(document).ready(function(){
var owl = $(".owl-carousel").owlCarousel({
autoplay: true,
autoplaySpeed: 300,
loop: true,
navSpeed: 300,
items: 1,
margin: 2
});
owl.on('changed.owl.carousel', function(e) {
alert("test");
});
});
Change date format in WordPress comments
add_filter( 'get_comment_date', 'aviweb_comment_date' ); function aviweb_comment_date( $date ) { $date = date("d/m/Y"); return $date; }
How can I fix RevSlider Fatal error in dashboard after upgrading to PHP 7
Please update below code in plugin file. It’s temporary solution only, you need to contact plugin support team.
path: revslider/includes/framework/base-admin.class.php private static $arrMetaBoxes = ''; to private static $arrMetaBoxes = array();
Increase PHP Memory Limit in WordPress
- Edit the wp-config.php file on your WordPress site
- Place below code
- This code tells WordPress to increase the PHP memory limit to 256MB
define( 'WP_MEMORY_LIMIT', '256M' );
Sort custom post table rows in wp-admin
add_filter( 'manage_edit-{custom_post_type}_columns', 'edit_custom_columns' ) ; function edit_custom_columns( $columns ) { $columns = array( 'cb' => '<input type="checkbox" />', 'title' => __( 'Tite' ), 'category' => __( 'Category' ), 'date' => __( 'Date' ) ); return $columns; }