Author:
erics, January 5th, 2021
|
global $wp; $slug_missing_outside_slashes = add_query_arg( array(), $wp->request ); $current_url = home_url( $slug_missing_outside_slashes ); $form_action = '/' . $slug_missing_outside_slashes . '/'; |
https://codex.wordpress.org/Determining_Plugin_and_Content_Directories
Categories: How-To's, Technology Tags: Current, howto, Page, Path, Slug, tips, URI, URL, WordPress
|
No comments
Author:
erics, October 13th, 2020
The first query gets all custom publication posts that have a value in field book_seq ordered by book_seq The second query gets all custom publication posts that have no meta value for book_seq or no meta record for key book_seq ordered by post_title.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
$querytop = get_posts(array( 'post_type' => 'publication', 'numberposts' => -1, 'orderby' => 'meta_value', 'meta_key' => 'book_seq', 'order' => 'ASC', 'meta_query' => array( // meta query takes an array of arrays, watch out for this! array( 'key' => 'book_seq', 'value' => array('', 'NULL'), 'compare' => 'NOT IN' ) ) )); $querybottom = get_posts(array( 'post_type' => 'publication', 'numberposts' => -1, 'orderby' => 'post_title', 'order' => 'ASC', 'meta_query' => array( // meta query takes an array of arrays, watch out for this! 'relation' => 'OR', array( 'key' => 'book_seq', 'compare' => 'NOT EXISTS' ), array( 'key' => 'book_seq', 'value' => array('', 'NULL'), 'compare' => 'IN' ) ) )); $store_query = array_merge($querytop, $querybottom); |
Great article here: https://rudrastyh.com/wordpress/meta_query.html
Categories: How-To's, Technology Tags: get_posts, meta_query, Or, php, Query, search, Store, WordPress
|
No comments
Author:
erics, July 11th, 2020
|
find wordpress/wp-content/plugins -type d -exec chmod 2775 {} \; find wordpress/wp-content/plugins -type f -exec chmod 664 {} \; find wordpress/wp-content/themes -type d -exec chmod 2775 {} \; find wordpress/wp-content/themes -type f -exec chmod 664 {} \; find wordpress/wp-content/upgrade -type d -exec chmod 2775 {} \; find wordpress/wp-content/upgrade -type f -exec chmod 664 {} \; |
Categories: How-To's, Technology Tags: chmod, howto, Permissions, tips, WordPress
|
No comments
Author:
erics, May 11th, 2020
|
add_filter( 'user_meta_admin_email_recipient', 'changeAdminEmails' ); function changeAdminEmails( $emails ) { return array( 'youremailtarget1@yourdomain.com', 'youremailtarget2@yourdomain.com' ); } |
Categories: How-To's, Technology Tags: admin, Admin Email, Change, Destination, Edit, Email, howto, meta, modify, Notification, Pro, Target, tips, User, user-meta, user-meta-pro, WordPress, WP, WP User Meta
|
No comments
Author:
erics, April 5th, 2020
Decided to go for it and dive into the world of the WordPress block editor based on the improvements in version 5.4 – First, the upgrade went smoothly. Second, switching to the new block editor was easy. Third, making this post seems pretty painless. I disabled full-screen mode because I simply don’t like it ;-} […]
Categories: Technology Tags: upgrade, WordPress, Wordpress 5.4
|
No comments
Author:
erics, January 24th, 2020
|
add_action('admin_init', 'redirect_non_admin_users' ); function redirect_non_admin_users() { if ( ! current_user_can( ‘manage_options’ ) && (‘/wp-admin/admin-ajax.php’ != $_SERVER[‘PHP_SELF’]) ) { wp_redirect ("Your_Destination_URL_Here"); die(); exit; } } |
Categories: How-To's, Technology Tags: /wp-admin/profile.php, Access, ajax, Disable, manage_options, Profile, profile.php, redirect, Subscriber, WordPress, WP, wp_redirect, wp-admin
|
No comments
Author:
erics, January 24th, 2020
If you are unable to update a plugin via the WP admin console, then you can do the update manually. Download the zip file to your local hard drive and extract it. Then, from the command line, do the test run first:
|
cd {extracted_plugin_directory} rsync -av --dry-run --delete ../{extracted_plugin_directory}/ theHost:/volumes/www/theSite/wordpress/wp-content/plugins/{extracted_plugin_directory}/ |
*Make sure to use the trailing slashes with rsync for proper operation […]
Categories: How-To's, Technology Tags: cli, Download, Error, Extract, Fail, howto, Manual, Plugin, rsync, Terminal, tips, update, WordPress, zip
|
No comments
Author:
erics, January 20th, 2020
PROBLEM Wordpress site broken with Javascript errors with zero plugins or themes installed. The issue followed different devices, OS’es and different browsers. SOLUTION User account corrupted. The wp_usermeta locale field had an invalid value of “regular”, and nulling the field solved the issue. DETAILS JS console shows this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
[Error] TypeError: Language code must have format 2-3 letters and. optionally, hyphen, underscore followed by 2 more letters language (mediaelement-and-player.min.js:12:7263) (anonymous function) (mediaelement-and-player.min.js:12:14817) d (mediaelement-and-player.min.js:12:259) r (mediaelement-and-player.min.js:12:414) Global Code (mediaelement-and-player.min.js:12:430) [Error] ReferenceError: Can't find variable: MediaElementPlayer (anonymous function) (mediaelement-migrate.min.js:1:363) Global Code (mediaelement-migrate.min.js:1:1179) [Error] TypeError: undefined is not a function (near '...).mediaelementplayer(e)}}},n(e.wp.mediae...') initialize (wp-mediaelement.min.js:1:855) i (load-scripts.php:2:27368) fireWith (load-scripts.php:2:28123) ready (load-scripts.php:2:29926) J (load-scripts.php:2:30282) [Error] TypeError: undefined is not an object (evaluating 'd.hasClass') (anonymous function) (wp-auth-check.min.js:1:1538) dispatch (load-scripts.php:3:12375) handle (load-scripts.php:3:9094) trigger (load-scripts.php:3:11494) trigger (load-scripts.php:8:8280) (anonymous function) (load-scripts.php:3:18873) each (load-scripts.php:2:2908) each (load-scripts.php:2:851) trigger (load-scripts.php:3:18846) (anonymous function) (heartbeat.min.js:1:2228) i (load-scripts.php:2:27368) fireWith (load-scripts.php:2:28123) x (load-scripts.php:4:22587) c (load-scripts.php:4:26778) |
Categories: How-To's, Technology Tags: Error, Errors, javascript, JS, Locale, TypeError, WordPress
|
No comments
Author:
erics, November 19th, 2019
All credit to Graham Walters for this excellent plugin and post, upon which this post is based – thank you, sir! https://grahamwalters.me/lab/disable-wpautop-on-specific-postspages/ Recently, a client was having problems using a plugin called by a shortcode. As it turned out, the JavaScript embedded in the returned content was being broken by the WordPress auto-paragraph feature known […]
Categories: How-To's, Technology Tags: add_filter, Auto-Paragraph, autop, Disable, Filter, howto, Page, POST, Prevent, remove_filter, Stop, tips, turn off, WordPress, wpautop
|
No comments
Author:
erics, November 19th, 2019
Normally, there is an option in the Screen Options menu to show or hide the Custom Fields tool. If this option is missing, you may have the plugin Advanced Custom Fields (ACF) version 5.5.13 or greater installed and active because ACF removes the Custom Fields tool to improve page load speed. If you do have […]
Categories: How-To's, Technology Tags: ACF, add_filter, Advanced Custom Fields, Custom, Custom Fields, Fields, Filter, functions.php, howto, meta, Settings, tips, WordPress, Wordpress Custom Fields
|
No comments