wordpress-plugin

Can I remove transients in the wp_options table of my WordPress install?

安稳与你 提交于 2019-11-29 19:05:12
I have recently noticed that my wp_options table seems to be a bit large. It contains 1161 rows, and is about 2.1mb in size. I have installed Clean Options . It looks like development stopped on the plugin back in 2010, but it still did the job. I now have a long list of potentially orphaned entries. Is there an easy way to go about sorting these, and figuring out which to remove and which to keep? Also, could this be responsible for causing performance issues with the website? Thank you for reading, any ideas are welcomed! Update : The Clean Options plugin returned some transients in the list

Too Many Post Data variables?

♀尐吖头ヾ 提交于 2019-11-29 17:01:29
It's my first time posting a question: I'm working on a WordPress plugin that allows the user to create rows of data in the database. I'm experiencing a problem when there are many (upwards of 100) rows of data to be updated by a form. Each row of data holds eight POST data variables, so when there are 100 rows in the form, over 800 post variables are sent. However, only a certain number of the variables update the database, right now only 112 rows update. I can't figure out what would stop the function from completing the update to the database. It almost seems like I'm overloaded with too

WooCommerce- How to remove product & product-category from urls?

我们两清 提交于 2019-11-29 16:54:06
问题 I'm using WooCommerce on a WordPress and it adds product & product-category to the URLs. http://dev.unwaveringmedia.com/8dim/product-category/all-party-supplies/ http://dev.unwaveringmedia.com/8dim/product/14-snowman-serving-tray/ I need to remove 'product' & 'product-category' from the URLs. Is there any way to modify the permalinks and remove them? 回答1: Its good practice for SEO and UX to have a product category base. Product category bases help to distinguish products from posts. I usually

Wordpress : Change title of sidebar widget dynamically

自作多情 提交于 2019-11-29 15:18:25
Is it possible to get the title of the widgets that I have enabled in my sidebar so I can insert that as a name for my class attribute? For example: 'before_title' => <h2 class="title of the widget">', If I inspect the element, I want to see: <h2 class="author"> and <h2 class="links"> etc... Thanks It's definitely possible, but if you want to do it dynamically, you'd need to use a filter. The dynamic_sidebar_params filter should work for you. If you're unfamiliar with what filters do, basically a filter allows you to edit content before it's displayed on screen or saved in the database. See

How to hook into Contact Form 7 Before Send

折月煮酒 提交于 2019-11-29 12:34:20
问题 I have a plugin I am writing that I want to interact with Contact Form 7. In my plugin I added the following action add_action add_action("wpcf7_before_send_mail", "wpcf7_do_something_else"); function wpcf7_do_something_else(&$wpcf7_data) { // Here is the variable where the data are stored! var_dump($wpcf7_data); // If you want to skip mailing the data, you can do it... $wpcf7_data->skip_mail = true; } I submitted the contact form but the add_action I had did nothing. I'm unsure how to make

google analytics custom plugin getting error invalid grant

心已入冬 提交于 2019-11-29 12:13:35
$client = new Google_Client(); $client->setAuthConfigFile(plugin_dir_url( __FILE__ ) . '/client_secrets.json'); $client->setRedirectUri('urn:ietf:wg:oauth:2.0:oob'); $client->addScope(Google_Service_Analytics::ANALYTICS_READONLY); $client->setIncludeGrantedScopes(true); $client->setAccessType('offline'); $client->revokeToken(); $auth_url = $client->createAuthUrl(); using a popup authentication with javascript and then if (!isset($_SESSION['access_token'])) { //$client->authenticate($_GET['code']); if($client->isAccessTokenExpired()){ $client->authenticate($this->options['authenication_code']);

How can I use is_page() inside a plugin?

故事扮演 提交于 2019-11-29 11:22:19
I want my plugin to register a script only in a certain page. For example, inside my plugin file I want to write something like this: if (is_page()) { $pageid_current = get_the_ID(); $page_slug = get_post($pageid_current)->post_name; if ($page_slug == 'articles'){ wp_register_script('myscript', '/someurl/main.js'); } } But I get the error: is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.) How can I, inside of a plugin,

Removing rel canonical added by Yoast SEO plugin

南笙酒味 提交于 2019-11-29 10:05:09
Couldn't find a solution after a quick google so thought i'd pop a quick post on here. Trying to remove a automatically added rel=canonical link (which is added by Wordpress SEO plugin - by Yoast). I actually want google to crawl each of the different subs even though it may not move away from the parent page. nautilus7 rel="canonical" has nothing to do with crawling. It has to do with indexing and prevents the same page from indexing twice or more. Anyway, if you still want to do this you can do it by adding this code to your functions.php: add_filter( 'wpseo_canonical', '__return_false' );

Multiple settings Wordpress Options Page plugin

陌路散爱 提交于 2019-11-29 07:46:57
I want to make an Options page with multiple settings for my plugin. I want to use this code as a start: http://codex.wordpress.org/Creating_Options_Pages#Example_.232 <?php class wctest{ public function __construct(){ if(is_admin()){ add_action('admin_menu', array($this, 'add_plugin_page')); add_action('admin_init', array($this, 'page_init')); } } public function add_plugin_page(){ // This page will be under "Settings" add_options_page('Settings Admin', 'Settings', 'manage_options', 'test-setting-admin', array($this, 'create_admin_page')); } public function create_admin_page(){ ?> <div class=

Wordpress: Accessing A Plugin's Function From A Theme

蹲街弑〆低调 提交于 2019-11-29 06:53:01
I'm trying to add some functionality from a plugin I have made into a Wordpress theme but I am having little joy. The documentation doesn't really help me solve the problem so perhaps someone here can help. I have a plugin in Wordpress that is activated and working fine. The class for this plugin has a function called generateHtml which I would like to access from a Wordpress Theme. But whatever I try, I cannot seem to access my plugin's code. Can either give me a summary of what I need to do to get a theme accessing code from a plugin and/or point out there I am going wrong in my code: Plugin