Skip to content

Instantly share code, notes, and snippets.

View mtx-z's full-sized avatar

Mtx Z mtx-z

View GitHub Profile
@mtx-z
mtx-z / wordpress-remove-author-page.php
Last active August 21, 2019 14:19
Wordpress/Woocommerce- redirect (remove) author pages
<?php
/**
* Disable access to Wordpress author page
*/
function remove_author_pages_page() {
global $wp_query;
if ( is_author() ) {
$wp_query->set_404();
@mtx-z
mtx-z / wordpress-acf-term-meta.php
Created May 27, 2018 17:24
WordPress\ACF - set real term_meta on ACF terms custom fields on update/create
<?php
/**
* ACF fix for term meta
* replace {{custom_term_meta_x}} by your ACF term custom field name
* TODO: loop over all term_meta to auto-generate filters
*
* https://support.advancedcustomfields.com/forums/topic/how-to-use-wp-term-meta-on-acf-the-easy-way/
*/
function acf_update_term_meta( $value, $post_id, $field ) {
Download Google Drive files with WGET
- replace FILEID with your Google Drive FILEID
- Google Drive file must have a public shared URL (file share options)
- will create a /tmp/cookies.txt to save cookies, and handle Google Drive "Big files" download verification
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt
@mtx-z
mtx-z / wp-bootstrap4.4-pagination.php
Last active April 4, 2023 12:55
Wordpress 5.4 Bootstrap 4.4 pagination (with custom WP_Query() and global $wp_query support) (UPDATED for Bootstrap 5: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* UPDATE for Bootstrap 5.0: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507
*