Aishan
  • Member for 5 years, 11 months
  • Last seen more than 1 year ago
Preventing session timeout
13 votes

By default, WordPress makes your login session cookie expire in 48 hours (or on browser close), or 14 days if you check the “Remember Me” box. Maybe you have some plugins which force your login cookie ...

View answer
Save custom user meta on registration
8 votes

You have to trigger the following hooks: user_register personal_options_update edit_user_profile_update add_action('user_register', 'addMyCustomMeta'); add_action('personal_options_update', '...

View answer
Is there a function to cause empty categories not to show in menus?
Accepted answer
4 votes

add_filter( 'wp_get_nav_menu_items', 'nav_remove_empty_category_menu_item', 10, 3 ); function nav_remove_empty_category_menu_item ( $items, $menu, $args ) { global $wpdb; $nopost = $wpdb->...

View answer
Regenerate thumbnails for images that are not in the media library
Accepted answer
3 votes

wp-content/uploads images wont regenerate if they are not shown in the Media Library because those media ID's needs to be there in the database.You need to first add your images on the media libray ...

View answer
Move Sidebar from Above Content To Below When Responsive
3 votes

Depending on which device you want to target, you'll need to use a media query, you can read more about those here: CssTrick: @media only screen and (max-width : 320px) { #content { ...

View answer
Create a sitemap without a plugin - get parent pages only?
2 votes

You have to slightly modify your query on your above code as: $postsForSitemap = get_posts( array( 'numberposts' => -1, 'orderby' => 'rand', 'post_type' => ...

View answer
How to list Category list in ACF Pro's Select Field to choose from
Accepted answer
2 votes

Set the "Return Value" of the taxonomy to Term ID. This will return the term/category id so that when you get the ACF taxonomy value by using get_field, it will return the id of your category. Then ...

View answer
get shortcode value
2 votes

add_shortcode('the_chart ', 'high_chart'); function high_chart($atts, $content = null) { //extract the cart and footer_caption value extract(shortcode_atts(array( '...

View answer
{{ Double Curly Brace }} data.____ Variable Source in WP_Playlist Template
Accepted answer
2 votes

Those are the Mustache-inspired syntax you are talking about. That can be acheived using wp.template Wordpress function. The script you showing is javascript templating in WordPress wp.template() ...

View answer
How to change "Shipping Calculator "field label on Cart Page - woocommerce?
1 votes

Add this to your functions.php: add_filter( 'gettext', 'woocomerce_text_strings', 20, 3 ); function woocomerce_text_strings( $translated_text, $text, $domain ) { switch ( $...

View answer
creating and styling a <div> within a page
1 votes

You could create a styled section/div in your page/post content by using WP shortcode. if you could manage a time then you could create your custom shortcode with your requirement. But if not then ...

View answer
Add a class to the anchor tag on HTML5 gallery
1 votes

f you mean to add a class on the anchor image wrapper that you have added using wp-editor then you could add folllowing code : this will filter the content and add class to your image <?php ...

View answer
Remove order field from Page Attributes box
1 votes

if you really just want to hide it from displaying or completely remove it. It’s a part of core Page Attribute Metabox which could'nt be remove permanently but this should help get you going in the ...

View answer
Wordpress database becoming huge. How to analyze and optimize it? fear of running out of memory
1 votes

The thing i do for this to minimize and optimize the database is by adding a two line of code on config.php define('AUTOSAVE_INTERVAL', 300 ); //seconds (default is 60) define('WP_POST_REVISIONS', 5 )...

View answer
first paragraph of the_content as meta description
Accepted answer
1 votes

You can use the_excerpt() instead of the_content Reference link for filter your excerpt : show-first-paragraph Or you can also do this by callback function inside your loop using the function to ...

View answer
AJAX request on the frontend always returns 0 if user is not admin
1 votes

Everything has to match here: JS: data: { action: 'save_like', likeCount: count, id: postId, userState: state, security: my_ajax_object....

View answer
Uploading images on front end doesn't generate thumbnail sizes
1 votes

wp_generate_attachment_metadata generates metadata for an image attachment. It also creates a thumbnail and other intermediate sizes of the image attachment based on the sizes defined on the ...

View answer
tb_show not showing a media upload window . custom plugin
1 votes

First you need to include thickbox into your theme to use tb_show popup function include_thickbox_scripts() { // include the javascript wp_enqueue_script('thickbox', null, array('...

View answer
contactform7 remove tags with "wpcf7_autop false" from functions.php
Accepted answer
1 votes

You can try minify html from the contact form 7 To completely disable the wpautop filter, you can use: remove_filter('the_content', 'wpautop');

View answer
Get full URL of WP plugin admin page
0 votes

$parts = parse_url( admin_url() ); $url = "{$parts['scheme']}://{$parts['host']}" . add_query_arg( NULL, NULL );

View answer
How do I redirect all 404 errors of a specific post type to another URL?
0 votes

If there is no page on your site with that post type, you need to ask yourself the question: should I really be deleting that page? Or should I just make it better? If you decide to make sure you send ...

View answer
How to hide image alt text/caption in Visual Composer?
0 votes

i had also the same issue when using the AVADA theme. It appends the title attribute on the image which is showing the text/caption when its being on hover. <script type="text/javascript"> /* ...

View answer
I was wondering if it's possible to implement card.js on WordPress
0 votes

Seems like you have misplaced the card jquery library. You can include the js using wp_enqueue_script in WordPress. wp_enqueue_script( 'jquery-card-script', get_stylesheet_directory_uri() . '/js/...

View answer
redirect_to not Including Hashtag from URL
0 votes

function after_login_redirect_to_destination(){ if (!is_user_logged_in() && !is_home()){ $redirect = home_url() . '/wp-login.php?redirect_to=' . urlencode( $_SERVER['REQUEST_URI'] )...

View answer
Need help with adding custom wordpress menu and sub-menu
0 votes

<div id="cs-header-menu"> <div class="cs-container"> <!-- Main navigation --> <div class="cs-toggle-main-navigation"><i class="fa fa-bars"></i>&...

View answer
How to restrict type/size of file uploads in any plugin?
Accepted answer
0 votes

You use upload_mimes filter to restrict the image type as : add_filter('upload_mimes','restict_image_type'); function restict_image_type($mimes) { $mimes = array( 'jpg|jpeg|...

View answer
How to add <ul> in WP_Query to every 3 posts displayed?
0 votes

Please use the code as below: $break_after = 3; $counter = 0; $args = array( 'post_type' => 'product', 'posts_per_page' => 8, '...

View answer
How to prevent Widget from echoing to wrong position in DOM
0 votes

dynamic_sidebar will output the sidebar when it is called. Try using it with buffering and store into a variable as below: <ul class="menu"> <?php $locations = ...

View answer
Force "Submit to review" when a post is updated
0 votes

The user with author role is somebody who can publish and manage their own posts. So you can't change the default capability of your author user to disable publish post. You can set all users (...

View answer
Remove a div with ID from the_content WordPress
0 votes

with the_content filter hook you can modify the content using PHP preg_replace search and replace function remove_specific_wrapper($content) { $content = preg_replace('#<div[^>]*id="some_id"...

View answer