Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

Shivani Sharma on "Google says some of my site pages may contain hidden text or cloaking, technique"

$
0
0

Google mailed me this.. now I want to ask my all WordPress user friends how to get out of it ?

http://all-specs.com/: Suspected hacking

Google has detected that some of your pages may contain hidden text or cloaking, techniques that are outside our Webmaster Guidelines.

Specifically, we detected that your site may have been modified by a third party. Typically, the offending party gains access to an insecure directory that has open permissions. Many times, they will upload files or modify existing ones, which then show up as spam in our index.

Sample URLs:

http://all-specs.com/
http://all-specs.com/apple-iphone-6-full-specs-features-release-date-price-in-india.html


jcc5018 on "adding post meta with sql query"

$
0
0

I have been trying to arrange my site so that my URL structure is set to domain.com/collection/%collection%/%product-group%

Where %collection% is a taxonomy term, collection is the index, and %product-group% is the product in question (its a group cause each group will list many product variations)

Anyway, wordpress seems unable to handle this simple task, so I am switching methods in order to get my permalink structure correct.

I am simply going to create the collection, product, and variant pages all under the same custom post type with no taxonomies to deal with. Then each will display a page template depending on the value of a custom field (collection, product, or variant)

Well, since I already have the products and variants already uploaded to their respective custom post types, I don't want to go through all the data again to set featured images and content. (If it werent for that, I would just re import all the data.)

So I created a function to switch post types in the data base for me. It works except for one part.

here is the code

function change_post_type($from,$to,$value)
{     global $wpdb;

//change metadata
$post_id = $wpdb->get_results ('SELECT ID FROM wp_hyhg_posts WHERE post_type=pods_product_grps' , object); 

         foreach ($post_id as $id){
$table='wp_hyhg_postmeta';
$data= array(
    'post_id' => $id,
    'meta_key' =>'input_type',
    'meta_value' => $value
);

$wpdb->insert( $table, $data );

      }

 //UPDATE
      $data2= array(
          'post_type' => $to,
           );
       $where =array('post_type' => $from );

  $wpdb->update('wp_hyhg_posts', $data2, $where);

      }

      change_post_type ('pods_product_grps', 'uc-product', 'product');

So, I was able to get the post type to switch from 'pods_product_grps to uc-product easily enough, but I also need to add a meta value 'input_type' to every product I just switched.

Since it is already changed, I can simply add input_type=>product to all products currently labeled as uc-product

But I also need to run this code where the function is:

change_post_type ('product_variant', 'uc-product', 'variant');

So I need to get the meta data figured out for the ones I just converted, before I add the new set of data to the mix.

The product and Variants input type both have additional sets of meta data that are displayed conditionally based on the value selected.

Products will have a field called group_id and variants will have a field (product sku) which contains the group_id plus a number

So I need another query that finds all post marked 'product', gets the post_id, then compares the group_id to product_sku and updates the parent_id field to the corresponding parent relationship.

That is probably confusing. In other words, a product variant is a child of a product if group_id is in product_sku So I'd like to make a query that populates the parent field of the post table based on that condition.

Hope someone can help with this one.

cocoonfxmedia on "Next Page"

$
0
0

Hi

I have a child theme. One of the templates lists the post excepts into a grid of 12 set in the query. I am looking to have a Next page function to show the next 12 posts but for some reason I can't see how to do it. Any advise would be good

natepelzel on "Universally Change Iris Palette"

$
0
0

Hey guys,

I use wordpress on most of my client's site, and I recently had the idea to alter the palette below the Iris color picker to match my client's color scheme. Make it quicker for me and easier for them.

I did some digging and found this site. It basically just said to paste this in my functions.php:

// customise palette colours
function firefly_customize_controls_print_footer_scripts() {
?>
<script>
jQuery(document).ready(function($){
$.wp.wpColorPicker.prototype.options = {
palettes: ['#ffffff', '#000000','#ff0000']
};
});
</script>
<?php
}
add_action('customize_controls_print_footer_scripts', 'firefly_customize_controls_print_footer_scripts');

Makes sense in theory, but I'm having the hardest time getting it to work. The script is definitely running. In my troubleshooting I put an alert in the script and it most definitely fired.

Any idea what I'm missing? I checked some color pickers on a few different pages, including one for my theme's built in settings and some in the theme customization page.

I'm pretty strong with php & css, and have been dabbling in javascript/jQuery for a while now, so I'm comfortable but not fluent with it.

Any ideas you all have would be greatly appreciated.

Dave McHale on "showposts in WP_Query"

$
0
0

Hi all,

I don't know if this has been discussed in the past so sorry if I'm bringing up old news... I was just digging through the WP_Query class and on line 2436 of /wp-includes/query.php there is code that supports the showposts parameter.

The parameter isn't even mentioned in the docblock, and according to the codex has been officially replaced by posts_per_page since 2.1 - so, 7.5 years ago. http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters (see the notes for posts_per_page)

Is this a case of "it's not hurting anything to keep it, and will do more harm than good to remove it"? Simply a case of "forgotten code"? Would/could/should it be officially deprecated so it can be removed later?

Just curious what others thought, or if anyone had any insight into previous conversations about this.

javedskt2006 on "In buddypress I disabled user registration someone create many user automaticaly"

$
0
0

my site is infected by spam user i dont know what is going on i also stop user registration but not solve the problem someone automatically create user in my database directly and also the user created is post link in activity.
plz someone help me i also use many different plugin of intvirus also use wanggaurd but not work perfectly

Ilona on "Why does WP automatically generates passwords on registration?"

$
0
0

Hi,

I've got a request from a client to overwrite WP registration form to ask user for email and password instead of email and username. While I know more or less how to do it, I am not very keen on the idea itself and was just wondering what are the cons of doing so in terms of security etc? Thanks

Yourit on "add class to archives widget in functions.php"

$
0
0

Hi,

I'm currently trying to add a Bootstrap class to the <select> of the archives widget into the functions.php file, so the select dropdown is styled correctly when checked in the CMS, but somehow i'm not able to find out what i'm doing wrong.

This is how it looks like right now(HTML):
<select name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">

This is how it should look like(HTML):
<select class="form-control" name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">

I've tried a str_replace in functions.php but it won't affect wp_get_archives.

Could someone please help me find a solution?
Thanks in advance!!!


wlakjihv on "than they would elsewhere"

Malcolm Streeton on "Reset password cookie from Plugin"

$
0
0

I am writing a custom user profile edit page. Currently this is done as a plugin accessed by a short code.
I want to update the password. However when this is done the user is logged out. I tried reseting the cookie for login using wp_set_auth_cookie to reset it but this gives an html error as it is trying to output before the header is output.

Note being logged out although not ideal would be OK, however the 'login with Ajax' plugin I am using does not update so it is only apparent you have been logged out when you go to a new page.

Any suggestion of how to make this work?. e.g can I include the code to reset the cookie in the text stream returned by the plugin function so it is output after the header?

LPH2005 on "wp_set_auth_cookie, external user logs into WP but cannot publish"

$
0
0

Hello,

Ever since 4.0 beta 2, WP turned on the feature for tying cookies and sessions together. Now plugin code that used to work for logging in an external user fails to allow the user (with correct permissions / roles ) to publish a post. The user can post a comment but cannot publish a WP post or page.

The error returned is "are you sure you want to do this?"

Code:

$visitor = $XF->visitor;
$user_ID = $visitor->get( 'user_id' );
wp_set_auth_cookie( $user_ID, 0, 0 );

Again, this code worked fine for years with previous versions but stopped with 4.0 beta 2 release. The user is logged into WP. It is the publish a post or page that fails.

Any suggestions on how to re-write the code?

Is this a problem in wp_verify_nonce?

cvcorv8 on "an 'extra block' [for example] IN sidebar on the right?"

$
0
0

Is it possible to do an extra block on the right side of the website

And if so how?

For example I want at the right places sidebar adverts.
instead of a left sidebar.

I like to hear comments

http://www.podiumervaring.nl

erikture on "WP_Query and orderby?"

$
0
0

I have written a plugin that lists the latest published or modified posts, pages or events in a list. However the orderby does not work.

This is my query:
$arg = array (
'post_type' => array( 'post', 'page', 'ai1ec_event'),
'post_status' => 'publish',
'orderby' => 'modified',
'order' => 'DESC',
'posts_per_page' => $noOfPages) ;
$query = new WP_Query($arg);
var_dump($query->request);

The output from var_dump is:
string(229) "SELECT SQL_CALC_FOUND_ROWS hi7ebp_posts.ID
FROM hi7ebp_posts
WHERE 1=1 AND hi7ebp_posts.post_type IN ('post', 'page', 'ai1ec_event')
AND ((hi7ebp_posts.post_status = 'publish'))
ORDER BY hi7ebp_posts.menu_order ASC
LIMIT 0, 5"

My 'orderby' => 'modified', 'order' => 'DESC' is not part of the sqlquery!

Why?

/Erik

storyswitch on "Enable mentions in a response post similar to Twitter"

$
0
0

I am developing a members site with Buddypress and Frontend Publishing Pro. My members will be publishing articles and rather than allowing comments, I want them to respond with another post. To do this, I want users to click a button at the bottom of the post that says 'respond to this post' and this will take the user to a page where they will write their blog post but it will have the prefix @john1234 similar to how Twitter does it.

Any ideas?

muzikworld on "Generating embed code for users to share"

$
0
0

Hello folks.

Recently I was stuck by an idea to let users and other bloggers to embed the entire page on of my blog on to their blogs. The problem is i have to change the URL every time in code and the codes populate the result on my page itself.
Is there any way by which the script could automatically fetch the URL of the viewing page and update it codes for users without generating the content on my page. This is what i was trying.

<object data=http://domain.tld/Requested_page width="100%" height="500"> <embed src=http://domain.tld/Requested_page width="100%" height="500"> </embed> Error: Embedded data could not be displayed. Visit <a title="Title of requested Page" href="http://domain.tld/Requested_page">Visit</a> </object>


jcc5018 on "adding taxonomy term based on custom fields"

$
0
0

I have a custom post type (uc-collections) that I am setting up so that different sets of custom fields are displayed based on the type of post it is. Its one of three (collection, product, or variant).

I have everything set up in that regard, but I am thinking that when designing my templates to display different data depending on the input type, it may be easier to do it if I had the input type defined as a taxonomy.

So I would like to update my post with the corresponding taxonomy that relates to the input type.

Existing meta_key is input_type with options (collection, product, variant)

I want the taxonomy term to be assigned with the value of the input_type. So the taxonomy (input) will also be either collection, product, or variant)

I presented this on stack exchange, and someone came up with this answer, but it is not working on my site, and I don't understand why. My taxonomies are set as hierarchical.

function wpdocs_set_terms_for_post_types() {
    $posts = get_posts( array(
        'posts_per_page' => -1,
        'post_type'      => 'uc-collections',
    ) );

    if ( ! empty( $posts ) ) {
        foreach ( $posts as $post ) {
            if ( $meta = get_post_meta( $post->ID, 'input_type', true )
                && $term = get_term_by( 'slug', $meta, 'input' )
            ) {
                wp_set_post_terms( $post->ID, $term->slug, 'input' );
            }
        }
    }
}
wpdocs_set_terms_for_post_types();

rabbitFoot on "Plugin install Page Templates"

$
0
0

I am writing a few plugins which require Page Templates;

1) Do these have to be installed in the current theme (and others if changed) or is there a shared place I can put them? If require to be installed in each theme then what is the standard / recommended method?

2) Is it best to use the plugin to create and write the files out or is there an inbuilt method for placing the templates?

rabbitFoot on "Add new page, etc"

$
0
0

Hi,

As my plugin installs (or by admin) i'd like to insert a new page and apply my template to it, then get the page link per the way the install is set up, so it can be redirected by my plugin.

Searching for new page brings up many different but all wrong topics...

mikeyhoward1977 on "Restrict which user accounts and User role can manage"

$
0
0

Is it possible to restrict which users a certain user role can edit/manage?

With my plugin I created a new role and gave that role the edit users capability which works fine. However, what if I only want this role to be able to edit certain users and display a wp_die message if they attempt to edit a user that they should not have access to?

Is there a hook that will enable me to do this?

tmac.org on "website hacked by another user"

$
0
0

It appears that my website has been hacked by another user in another country. What do I do to restore my account?

Viewing all 8245 articles
Browse latest View live




Latest Images