Loading...

Follow WordPress Development Stack Exchange on Feedspot

Continue with Google
Continue with Facebook
or

Valid

My website has been blocked by google, and it gives warnings to visitors that it is a Deceptive Site.

I checked the google transparency report to see the cause and It says that the problem is on the url: https://caretech.co.tz/wp-includes/js/jquery/jquery.js?ver=1.12.4

I do not know what to do to the jquery.js file to solve the problem.

I need help?

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In a CentOS with Bash A WordPress plugin (most likely WordFence) changes my .htaccess file by deleting extraneous (Apache PCRE) directives I've added there, and I can't access httpd.conf to add them there instead, as that's a shared server environment, so I'm quite stuck.

By "extraneous directives" I meant to all directives I've manually added below:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

I didn't find a way to stop making WordFence do so.

Considered workarounds:
  1. Repeatedly (daily) re-creation of .htaccess from a local template by a cronjob.

  2. Repeatedly (daily) appending the extraneous parts of all .htaccess files from a template (via a complicated script).

Both solutions doesn't seem appealing.

My question

What is the correct solution from your understanding?

Maybe creating the file from an online, formal, WordPress template? Maybe something else?

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

was just curious if anyone has any insight on how to implement real time features into wordpress, specifically with socket.io, preferably with my own plugin (or without). i have a project idea that i have used similar features outside of wordpress with socket.io, but the backend stuff is tripping me up a bit and i need some direction.

i did come across this video of guillermo rauch demoing socket io on wordpress and he makes it seem easy, but he's going too fast and i don't understand what socket-redis is, which seems to make it work. he starts demoing a little before halfway through the video: https://wordpress.tv/2014/11/03/guillermo-rauch-realtime-communication-with-socket-io-and-wordpress/

there is also a udemy class i found where they implemented zeroMQ and express.

i haven't found much else but these two, was wondering what the differences were and if one was better than the other, or if there are other ways i can do this. thanks for any help.

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

When editing a Woocommerce product in wp-admin there is a Product Data section with vertical tabs each of which has its own form fields to fill out.

A plugin has added fields that I don't want to the General tab.

What filter hook would I use to access a tabs field array and modify it as needed? (remove it)

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I try to select DISTINCT meta_value and return the post_id of it:

 $query = $wpdb->prepare(
    "SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s",
    $key);

This is return array of meta_value, but how to get the post_id instead ?

Thanks

EDIT:

Full function:

this return post_id but only 2 records.

DISTINCT meta_value, return 700 records...

array(2) { [0]=> string(6) "431081" [1]=> string(6) "431377" }

$p = filter_custom_fields('product_cip', $catsearched, 'product_cat');
var_dump($p);

function filter_custom_fields($key='', $terms='', $tax='', $selkey='', $selval='') {
global $wpdb;
$include = '';
if ( $selkey && $selval && ( is_string($selval) || is_array($selval) ) ) {
    $include = " AND post_id IN (" .
        $wpdb->prepare("SELECT DISTINCT post_id FROM $wpdb->postmeta
             WHERE meta_key = %s AND meta_value ", $selkey );
    if ( is_array($selval) ) {
        $selvals = '';
        foreach ( $selval as $val ) {
            if ( $selvals != '' ) $selvals .= ',';
            $selvals .= $wpdb->prepare('%s', $val);
        }
        $include .= "IN ($selvals))";
    } else {
        $include .= $wpdb->prepare( "= %s)", $selval );
    }
}
if ( ! empty( $terms ) ) {
    if ( is_array($terms) ) {
        $terms = array_map('intval', $terms );
        $ttis = $wpdb->get_col("SELECT term_taxonomy_id FROM 
            $wpdb->term_taxonomy WHERE 
            term_id IN (" . implode(',', $terms ) . ")");
        if ($ttis) {
            $include .= " AND post_id IN (SELECT DISTINCT object_id
         FROM $wpdb->term_relationships WHERE
         term_taxonomy_id IN (" . implode(',', $ttis) . "))";
        }
    } else {
        $field = is_numeric($terms) ? 'id' : 'slug';
        $term_obj = get_term_by( $field, $terms, $tax);
        if ( $term_obj && ! is_wp_error($term_obj) ) {
            $include .= ' AND post_id IN (' . $wpdb->prepare(
                    "SELECT DISTINCT object_id FROM $wpdb->term_relationships WHERE
         term_taxonomy_id = %d", $term_obj->term_taxonomy_id
                ) . ")";
        }
    }
}
$query = $wpdb->prepare(
    "SELECT post_id, meta_value FROM  $wpdb->postmeta WHERE meta_key = %s GROUP BY meta_value",
    $key);
if ( $include ) $query .= $include;
$meta = $wpdb->get_col($query);
if ( $meta ) return array_map('maybe_unserialize', $meta);

}

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I have products on my website who can be bought in one payement or three payment. I want to avoid user buy the same product if he has already bought one of these . Ex: Product at 99€ or 3 times 33€. If he bought the 99€ product, i want thé 3-times 33€ same product can’t be buy. How can i achieve this please ? Thank you

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I recently purchased this plugin (Currency per Product), and all works fine until you get to checkout and it defaults to some random currency at checkout in the order review panel. I presume it is a cache issue, but was wondering if there was a way to cache the products specific currency so that it overrules what the Order review panel says...

I saw this method for a different plugin, which works (sort of). By sort of I mean if I am admin, it removes my top menu for accessing dashboard, so the code isnt clean and I cannot figure out why...Any help would be greatly appreciated.

PS - I do have the settings correct for the plugin as confirmed by others, but there seems to be a lingering issue.

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

I have installed Newspaper theme on my Wordpress theme about two years ago. Everything worked fine, but then Instagram widget, in the theme stopped refreshing. I tried to remove Instagram settings but it didn't help. Does anyone have the solution to this problem or did anyone experienced something similar? I have no idea what to do.

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

i tried enqueue the bootstap with functions php

wp_enqueue_style('bootstrap4', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css');
wp_enqueue_script( 'boot1','https://code.jquery.com/jquery-3.3.1.slim.min.js');
wp_enqueue_script( 'boot2','https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js');
wp_enqueue_script( 'boot2','https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js');

css seems to work but none of the js files are working..not sure what i am doing wrong..

please help thank

Read Full Article
Visit website
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

this code works correctly. But how to display

<?php echo $quote; ?>

on single.php?

It only appears inside the user profile page.

Do I need to display In single.php

function wpse_230369_quote_of_the_day( $user ) { 
$quote = esc_attr( get_option( 'quote_of_the_day' ) );
?>

 <div >
<h3>Quote of the Day Input Field</h3>
<table  >
    <tr>
        <th><label for="quote_of_the_day">Quote of the Day</label></th>
        <td>
            <?php if ( current_user_can( 'administrator' ) ) : ?>

                <input type="text" name="quote_of_the_day" value="<?php echo $quote ?>"  />

            <?php else : ?>

                <?php echo $quote ?>

            <?php endif ?>
        </td>
    </tr>
</table>
</div>

<?php
}

add_action( 'show_user_profile', 'wpse_230369_quote_of_the_day', 10 );
add_action( 'edit_user_profile', 'wpse_230369_quote_of_the_day', 10 );

function wpse_230369_save_quote_of_the_day( $user_id ) {
if ( isset( $_POST['quote_of_the_day'] ) && current_user_can( 
'administrator' ) )
    update_option( 'quote_of_the_day', sanitize_text_field( wp_unslash( 
$_POST['quote_of_the_day'] ) ) );
}

add_action( 'edit_user_profile_update', 'wpse_230369_save_quote_of_the_day' );
add_action( 'personal_options_update',  'wpse_230369_save_quote_of_the_day' );

I inserted Echo just below the input, it works correctly, I just need to display in single.php

Read Full Article
Visit website

Read for later

Articles marked as Favorite are saved for later viewing.
close
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Separate tags by commas
To access this feature, please upgrade your account.
Start your free month
Free Preview