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

nikhilbhuktar on "Error after updating database"

$
0
0

While I was trying to access my website I received instruction for updating the database, I was getting same message while accessing my wp-admin too. After that I clicked on the update button available on the screen. After updating I'm getting error as follows:
Call to undefined function wp_json_encode() in wp-includes/class.wp-scripts.php on line 186.

Coding is not a strong part of my skill. I would appreciate if anyone provides me a simplified and step by step solution for this.


Moe_Jizzles on "Attackers on my site"

$
0
0

I'm trying to log into the wp-panel of my website and i'm not able to do that. I'm getting an all red page that says:

"The site ahead contains malware

Attackers currently on 122.155.168.105 might attempt to install dangerous programs on your Mac that steal or delete your info. "

And I can't get to my page.

So what can or do I do about this??

PLEASE HELP!!!

obaino on "using frontend uploader,setting maximum file size upload"

$
0
0

am using frontend uploader and I will like a situation were I can set maxi size of file for user to upload...pls I need your help.thanks in advance.

Elliotvs on "Created a plugin, host files externally?"

$
0
0

Hello

I have created my own advanced plugin. I wondered how it is possible to make it so people don't directly download the files for the plugin and instead they are hosted externally and they have a membership which must be active to use the plugin.

I have seen some plugins do this so I believe its possible but dont know how.

Any help is appreciated.

Thanks

Elliot

Russ Powers on "Custom Post Type Permalink Structure"

$
0
0

This is a long shot, but I ran into a bit of snag with permalink structures. My initial goal was to have a posts page called News & Updates. I wanted my permalink structure for both categories and posts to match the posts page. So here's what my permalinks look like...

Posts Page:
http://www.mysite.com/news/

Post Category:
http://www.mysite.com/news/category/

Single Post:
http://www.mysite.com/news/category/post

To achieve this I used the Custom Permalinks options in Settings > Permalinks. The custom structure I used is

/news/%category%/%postname%/

It's works great and serves it purpose. I was even able to get breadcrumbs to reflect my structure!

So the problem I've run into. I'm trying to create a custom post type for events. The only major issue is my events permalinks look like this...

http://www.mysite.com/news/events/event-name

Does anyone have an idea how I can get the permalink to read like the following while preserving the permalink structure for normal posts and categories?

http://www.mysite.com/events/event-name

Ryan on "Using pre_get_posts to update query of a child post no longer works as expected"

$
0
0

The requirement was that parent and child pages, of a specified custom post type, would be accessible by making a request to the root domain followed by the page slug.

In other words, instead of having URLs like this:

example.org/services/web-development
example.org/services/web-development/wordpress

The goal was to have URLs like this:

example.org/web-development
example.org/wordpress

This was accomplished by using the post_type_link filter and the pre_get_posts action hook.

Here is the code for post_type_link:

function post_type_link($permalink, $post, $leavename) {

	// Post types of interest
	$post_types = array('services');

	// If not post type of interest
	if(!in_array($post->post_type, $post_types)) {

		return $permalink;
	}

	// Break URL into scheme, host, path and query
	$url_components = parse_url($permalink);

	// Save path component from URL
	$post_path = $url_components['path'];

	// Do nothing if root URL
	if($post_path == '/') {

		return $permalink;
	}

	// Strip beginning and trailing slash from path
	$post_path = trim($post_path, '/');

	// Do nothing if there is no post slug
	if(empty($post_path)) {

		return $permalink;
	}

	// Break down post slug
	$post_slugs = explode('/', $post_path);

	// Extract post name from post slugs
	$post_name = end($post_slugs);

	// Do nothing is post name is empty
	if(empty($post_name)) {

		return $permalink;
	}

	// Remove parent slugs from URL
	$permalink = str_replace($post_path, $post_name, $permalink);

	return $permalink;
}

Here is the code for pre_get_posts:

function pre_get_posts($query) {
	global $wpdb;

	// If user is browsing the website
	if(!is_admin()) {

		// If query is main page query
		if(!$query->is_main_query()) {
			return;
		}

		// Get the post name
		$post_name = $query->get('pagename');

		// Look up the post's post type via the post name
		$post_type = $wpdb->get_var(
			$wpdb->prepare(
				'SELECT post_type FROM ' . $wpdb->posts . ' WHERE post_name = %s LIMIT 1',
				$post_name
			)
		);

		// If look-up was successful
		if(!empty($post_type)) {

			// Determine actions based on post type
			switch($post_type) {

				case 'services':
					$query->set('services', $post_name);
					$query->set('post_type', $post_type);
					break;

			}
		}
	}
}

This worked successfully in WordPress 3.9.3 and below, but stopped working in WordPress 4.0 and up.

Specifically, parent pages still load fine, but child pages now return a 404.

If I print out $wp_query on both a parent and child page, in both the template (single-services.php) and in pre_get_posts, I see my WP_Query adjustments were applied for both parent and child page.

I also see my changes applied in the template for the parent page. In other words, a post is, in fact, returned and this is the query it made:

SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND (wp_posts.ID = '1234') AND wp_posts.post_type = 'services' ORDER BY wp_posts.post_date DESC

But I don't get that result when a child page is requested:

SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND (wp_posts.ID = '0') AND wp_posts.post_type = 'services' ORDER BY wp_posts.post_date DESC

What stands out is that the ID is zero.

I looked back over query.php (in WordPress 4.1) and on line 2585 is the following conditional:

if ( isset($this->queried_object_id) ) {
	$reqpage = $this->queried_object_id;
} else {
	if ( 'page' != $q['post_type'] ) {
		foreach ( (array)$q['post_type'] as $_post_type ) {
			$ptype_obj = get_post_type_object($_post_type);
			if ( !$ptype_obj || !$ptype_obj->hierarchical )
				continue;

			$reqpage = get_page_by_path($q['pagename'], OBJECT, $_post_type);
			if ( $reqpage )
				break;
		}
		unset($ptype_obj);
	} else {
		$reqpage = get_page_by_path($q['pagename']);
	}
	if ( !empty($reqpage) )
		$reqpage = $reqpage->ID;
	else
		$reqpage = 0;
}

On the parent page, $reqpage is 1234, but on the child page, $reqpage is 0.

I found that this is because $reqpage = get_page_by_path($q['pagename'], OBJECT, $_post_type); returns a WP_Post object for the parent page, but 0 for the child page.

Looking at the get_page_by_path function in post.php, I noticed the following on line 4215:

if ( $p->post_parent == 0 && $count+1 == count( $revparts ) && $p->post_name == $revparts[ $count ] ) {
	$foundid = $page->ID;
	if ( $page->post_type == $post_type )
		break;
}

If I remove this check: $p->post_parent == 0, the child page loads fine. From what I can tell, however, this part of the code wasn't updated since 2011, so I don't think that's the issue.

All that said, that's where I'm at with troubleshooting. I figured I'd post it here in case I missed something, someone has an idea of what might be affecting this, or suggestions on how to resolve it.

PS: I did the following statement in the pre_get_posts docs today:

pre_get_posts cannot be used to alter the query for Page requests (page templates) because 'is_page', 'is_singular', 'pagename' and other properties (depending if pretty permalinks are used) are already set by the parse_query() method.

I don't know if that was always there, but it sounds like this is what I'm trying to do, depending on your interpretation of "Page" and whether it's used generally, Posts vs Pages, or anything not custom post type. My code did, nevertheless, work since the update to 4.0.

globalchangeawareness on "Blocking / Restricting Certain WordPress Post Tags"

$
0
0

Hello,

I am currently using a plugin that auto generates tags from a post title. Not ideal but as we have a number of authors posting and many of them are massively WordPress literate, this seemed to be the best way to go to ensure post tags were always being created.

However, I have come to discover quite an obvious problem. It also creates tags for words such as:

The
And
Us
You
Youre
That
This

etc.

Is there any way to block these tags from being created / a way to quickly delete them all in one go without having to go through each tag and tick the box?

I'm fairly literate with code, and would happily do this through a script.

Just seeing what options may be available and also looking for a push in the right direction.

I'm thinking that it could be easier to create a script that has an array containing all the words I wish to remove from tags in the database and then whenever I wish to clean out these tags I run that script, would anyone be able to let me know if this is possible?

Or if there is another, easier way to accomplish this?

Joshson on "Unable to login to wp dashboard"

$
0
0

I don't know why I can't login to my site dashboard. If you check my webpages you see boxes appearing in place of icons. Once these icons appear again, I will be able to login but on the other hand if those icons change back to boxes as it is now, I can't login to my dashboard. my website is http://www.bibliofy.com. I have contacted bluehost, my hosting provider, and they convincingly told me that wordpress is responsible for that. So why the problem?


toho on "Display custom user text"

$
0
0

Hi All!

I would like to ask you how can I go about getting text data from user and then displaying this custom per user text on their account page. Can I use custom fields for this? Should I write my own plugin or something similar already exist?

I will appreciate your help. I don't expect full solution, just looking to be pointed a direction. I did some research, but couldn't find anything about this specific problem.

Have a great day!

charlesdon on "unable to login to my wordpress dashboard"

$
0
0

I finds it difficult to login to my wordpress account. Meanwhile, i logged in some hours ago to install some woo commerce plugins, all of a sudden when i logged out and want to login again i received this message

Warning: Cannot modify header information - headers already sent by (output started at /home/content/69/11856369/html/loadedbay/wp-content/plugins/woo-display-your-currency/woo-display-your-currency.php:80) in /home/content/69/11856369/html/loadedbay/wp-login.php on line 424

Warning: Cannot modify header information - headers already sent by (output started at /home/content/69/11856369/html/loadedbay/wp-content/plugins/woo-display-your-currency/woo-display-your-currency.php:80) in /home/content/69/11856369/html/loadedbay/wp-login.php on line 437

and this:

ERROR: Cookies are blocked due to unexpected output. For help, please see this documentation or try the support forums..

Please what could have gone wrong i need your urgent replies.

Thanks.

powerflash on "set specific page for a cname domain"

$
0
0

I park additionals domain name on my wordpress installation, I want that with specific parking domain will specific wordpress page loaded.
I use a static page for home page of main domain, I think that good solution is set on the fly a new page id like home page, for example:

example.com -> front page id 1
subdomain1.example.com -> frontpage id 2
parkingdomain.com -> frontpage id 3
... etc

allisondoty on "How to move LayerSlider WP to front? Problems in Firefox only"

$
0
0

Lawd, someone help! I'm not totally web illiterate, but when I have to get in the code I'm a bit hit or miss. I would love some of your genius!

Here's my site: http://www.abodyinspired.com/

I have an opt-in bar that looks fine in chrome and safari, but then goes wide in Firefox. I hired a web designer to set it up for me, who has since gone MIA, so I'm on my own now.

Here's the problem (see links for screen shots):
http://www.abodyinspired.com/wp-content/uploads/2014/12/Screen-shot-2014-12-19-at-10.29.25-AM.png
http://www.abodyinspired.com/wp-content/uploads/2014/12/Screen-shot-2014-12-19-at-10.29.37-AM.png

I'm thinking it's a problem with LayerSlider WP, since it looks like it almost needs to be moved to front?

Another note: It was working fine before I uninstalled WPSuperCache (I was having problems with my posts not updating), and then it went wonky. I tried reinstalling and it stayed broken. I don't see why that would have caused it to break, but it's worth noting.

Help me wordpress gods! Happy Holidays!
Allison

wpsayan on "Limit Login Attempts in combination with zm ajax login & register"

$
0
0

Hello,

I have a problem with Limit Login Attempts in combination with zm ajax login & register.
The user will log in & register on the frontend of the website. Their profile page is also on the frontend where they can view there details.
But I am having a lot of fake admin login attempt. Limit Login Attempts is doing fine stopping this from wp-admin. But as I want to let customers login from frontend I used zm ajax login & register but here it failed to restrict.

https://wordpress.org/plugins/limit-login-attempts/
https://wordpress.org/plugins/zm-ajax-login-register/

Does anybody know?

Thanks in advance

f.n174 on "Which one is better using $_POST directly in plugin file or using admin-ajax.php"

$
0
0

Usually all WORDPRESS developers uses admin-ajax.php for receiving data from ajax in their plugin .
But also it is possible to add query vars or receiving posted data directly in main plugin file , and then saving that in a global variable.
This way we can receive posted data in an easier way. but is it safe ? and why all uses admin-ajax.php in their plugin ?
thanks.

ohnoezmahblog on "WordPress admin menus :hover functionality"

$
0
0

Hey All,
I was noticing that the WordPress admin menu handles touch vs. hover events very elegantly-- if you hover over an element it expands the submenu, and then you can click with a mouse to go to that link. Or if you touch it it will expand (but not follow the link), and then if you touch it again it will go to that link, or if you touch elsewhere it will collapse the submenu.

I can't quite figure out how it's implementing that-- but it seems to work better than the hover submenus touch functionality I coded, so I'd like to know how. I notice that it has the aria-haspopup="true" property, is that it?

thxthx!


sonofara on "Is this a new hacking injection"

$
0
0

Hi all,

need a little help i see this code in very first line of every .php file is this a hacking code? or some kind of encryption released from wordpress?

[ Malware deleted, do not post that in these forum please. ]

fw_w on "Can't receive $_POST or $_GET var in WP Plugin"

$
0
0

Hi

I'm trying write a wp plugin and want to post a form using HTTP POST. The problem is I can't receive $_POST when submit my form in plugin's class. It works outside my class only.

I hooked the function using this in my class constructor:
add_action('admin_post_add_foo', array($this, 'add_foo')

And in a function let's say I just want to dump $_POST var:

public function add_foo() {<br />
   var_dump($_POST);<br />
}

which doesn't work.

hoehoe on "PureChat work on desktop but not on mobile"

$
0
0

Hi,

I have tried many option from PureChat dashboard to Wordpress but with not much help, is this because my theme does not support PureChat? I have tried many different livechat plugin its seem to work on both desktop and mobile device but their function is clearly not what I wanted eg: instantly chat through mobile app.

So my question is how do I get PureChat to work on mobile device not just on Desktop.

Thank You

perpetual.design on "Properly Run Pop Up-Javascript in Wordpress"

$
0
0

I have modified and designed a javascript popup for a client. It works perfectly in a test.html page on my client's site.
Test

I now need to run it in wordpress. I know that I need to enqueue and register the stylesheet and javascript. But where? In a custom-functions.php file? The theme automatically includes that file in it's standard functions.php, if cust.. exists.

After that, what would be the best place to put the html? In the footer? On the home page? My goal is for the pop-up to appear only on the homepage. Right now, putting the pure html in a page doesn't work. The display:none css is added by the javascript. As well as the other form functions.

If you look at the test.html source you can see the references to jquery and javascript in the custom popup.js and the styles.css.

I simply need the easiest way to incorporate this standard ajax/php style form into wordpress. I appreciate any help!

Mubbi Qureshi on "Change Uploads Directory In WP 4.1"

$
0
0

i want to change the default directory of uploads i.e " wp-content/uploads "
i want to set it to " xyz.com/media "

I used UPLOADS constant in wp-config and it is changing the url of the uploaded media but the media is not found on the server or you can say it was not uploaded in that directory...

Kindly tell me how can i change the uploads directory in WP 4.1

Viewing all 8245 articles
Browse latest View live




Latest Images