artnik7
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How to know category ID in plugin file?vtxyzzy
I’m already solve the problem but it was to complexly. In general I need to disable whole plugin for specific category (with slug “blog”). But any of default WP functions doesn’t works in the begin of plugin file, maybe thats because them should be used using add_filter or add_actions.I wrote a function
function is_blog() { $current_post_categs = get_the_category(); $is_blog = false; foreach ($current_post_categs as $categ) { if ($categ->category_nicename == 'blog' || $categ->slug == 'blog') { $is_blog = true; } } return $is_blog; }And now I’m use this function in the begin of any plugin function. For example:
my_function() { if (is_blog()) return; // function content } add_filter('get_comment_link', 'my_function');It works, but there are many functions in this plugin and for each of them I’ve add “if (is_blog()) return;”.
Forum: Fixing WordPress
In reply to: Any WP function is not working in the top of the plugin fileThanks, Jan. I have tried a lot of various WP functions to get categ. id, but seems like only one of them works in plugin files – get_the_category().
So, if someone interesting in, here is the code, that helps to find current category:
foreach(get_the_category() as $category) $catid = $category->cat_ID; if ($catid == 9) { // plugin content }Forum: Fixing WordPress
In reply to: Any WP function is not working in the top of the plugin fileI’m trying to do something like this:
if (is_category('9') { // plugin content })Forum: Fixing WordPress
In reply to: Any WP function is not working in the top of the plugin fileYes I’m trying to use functions without add_filter() or add_action(). This could be the problem?
Forum: Fixing WordPress
In reply to: logout is triggered at the entrance to the wp-admin.sabinou1
Thanks! I have deactivate all plugins though phpMyAdmin and now control panel works. It remains to find a plugin which probably is not compatible with new version of WordPress.Thank you, sabinou1!
Forum: Fixing WordPress
In reply to: AJAX all-time returns the content for the not logged userAny body here?
header(“Content-type: text/html; charset=UTF-8”); will not halp to.
I’v already solved the problem in .htaccess file, that I’v upload in my WP home directory.
So… Create a file .htaccess with this codeAddDefaultCharset utf-8 AddCharset utf-8 * <IfModule mod_charset.c> CharsetSourceEnc utf-8 CharsetDefault utf-8 </IfModule>and upload it into your site home directory, and it will work well!