May 4, 2011

removing changing category names | CyberSEO Pro | Support Forum

Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_TopicIcon
removing changing category names
Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 (0 votes) 
September 15, 2013
10:23 pm
Avatar
ninja321
Member
Members
Forum Posts: 84
Member Since:
August 26, 2013
sp_UserOfflineSmall Offline

Hello,

how can I tell cyberseo to rename certain categories names. Also, how can I get cyberseo to skip specific categories?

Thx!

September 16, 2013
2:45 pm
Avatar
CyberSEO
Admin
Forum Posts: 3950
Member Since:
July 2, 2009
sp_UserOfflineSmall Offline

All category names are being stored in the $post ['categories'] array, so you have to work with it's values. For example, to rename "this" to "that" you may use the following code:

Login to see the code

 

October 1, 2015
12:40 pm
Avatar
ninja321
Member
Members
Forum Posts: 84
Member Since:
August 26, 2013
sp_UserOfflineSmall Offline

It works like a charm but how do I completely delete specific categories? If I use

Login to see the code

then the parser doesn't work.

October 3, 2015
2:08 am
Avatar
CyberSEO
Admin
Forum Posts: 3950
Member Since:
July 2, 2009
sp_UserOfflineSmall Offline

Login to see the code

Find more info here: Login to see this link

December 1, 2016
8:14 pm
Avatar
schiz
Member
Members
Forum Posts: 29
Member Since:
July 26, 2011
sp_UserOfflineSmall Offline

Sorry to reopen an old thread, but for whatever reason I've been unable to unset an array element using this method. array_diff seems to work just fine, though.

unset($post['categories']['r']);

vs

$post['categories'] = array_diff($post['categories'], ["r"]);

Any idea one works, but the other doesn't?

 

Thanks!

December 2, 2016
1:53 am
Avatar
CyberSEO
Admin
Forum Posts: 3950
Member Since:
July 2, 2009
sp_UserOfflineSmall Offline

Because there is no 'r' element in your $post['categories'] array. Most likely you have something like this:

$post['categories'][5] = 'r';

or this

$post['categories'][0] = 'r';

To remove the $post['categories'] element, you have to specify its numerical id, but not its value. E.g.:

unset($post['categories'][3]);

December 2, 2016
7:58 am
Avatar
schiz
Member
Members
Forum Posts: 29
Member Since:
July 26, 2011
sp_UserOfflineSmall Offline

I guess I'm a little confused. How do I unset category by name? I tried the snippet you supplied. I understand how unset works and have used it with other arrays. If I have a category called "dogs" that I want to unset, wouldn't I just use this?

unset($post['categories']['dogs']);

I'm looking to unset by value, not element number.

Thanks!

December 2, 2016
8:13 am
Avatar
CyberSEO
Admin
Forum Posts: 3950
Member Since:
July 2, 2009
sp_UserOfflineSmall Offline

The solution for any coding-related task can be found at Stack Overflow (a very useful resource BTW). E.g.:

Login to see this link

Login to see this link

Login to see this link

So you can do it using both Login to see this link functions.

Forum Timezone: Europe/Amsterdam

Most Users Ever Online: 541

Currently Online:
7 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

ninja321: 84

s.baryshev.aoasp: 68

Freedom: 61

Pandermos: 54

MediFormatica: 49

B8europe: 48

Member Stats:

Guest Posters: 337

Members: 2856

Moderators: 0

Admins: 1

Forum Stats:

Groups: 1

Forums: 5

Topics: 1643

Posts: 8359

Newest Members:

info.conversieonline, samuel2288, comercios.cercademi, wanmarkets, torontomark48, info.ckmedianetwork

Administrators: CyberSEO: 3950