Tag Info

New answers tagged

0

Unfortunately, WordPress does not expose functionality to do that. It only supports the register_uninstall_hook hook. This hook is called when the user clicks on the uninstall link that calls for the plugin to uninstall itself. The link won't be active unless the plugin hooks into the action. see ...


0

The GravityForms plugin renames the top level menu item to match the first of the sub-menu. For example; if you've added just the gravityforms_view_entries capability to the Editor role, then the first sub-menu item will be "Entries", so the parent menu will be "gf_entries" not "gf_edit_forms". So, the following code will remove the "Help" item from the ...


0

Short, a new database table would be an absolute overkill. I think, what you want to do is pretty much resembling the existing menu_order column in wp_posts. Using post meta is just fine, but add it on the the singular staff member posts from your custom post type. So you will have several custom order metas saved for them. And then retrieve the posts ...


4

That's a Serialized Array which turns an array into a simple string so that it can be inserted into a database ( since you cannot just insert arrays into a database as they are ). For more information you can read into the PHP docs for serialize() There is also some WordPress functions which do the same: maybe_serialize() and maybe_unserialize(). This ...


2

In the meta_query arguments, try changing your 'type' => 'CHAR', to 'type' => 'DATETIME', You can opt for any one of these, depending your needs: type (string) - Custom field type. Possible values are 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED'. Default value is 'CHAR'. But ...


0

It seems your XML file not valid. Try to import another xml and check. If another xml imports then its 100% issue with your XML in which you are getting error.


0

Just to add to Pippin's answer, in my case some content were also being shown in other parts of the single page, e.g. sidebar. Checking just is_single() also triggered the content modification in the other areas. Here's another check so that only the main content will have appended stuff: function yourprefix_add_to_content( $content ) { if( is_single() ...


2

Plugins load before themes. The earliest hooks available to plugins is plugins_loaded (or muplugins_loaded for mu-plugins), while themes run on after_setup_theme and later hooks. So you better just load the file [that contains the class] on a specific hook in your plugin. It probably is best to load it on a lower priority than the default 10. Below I use 5 ...


0

Plugins are loaded before functions.php. You should include the class in your plugin if possible. I have had scenarios where a class was part of the theme, but also needed in a plugin where you couldn't assume the class was included in the theme. In those cases, I simply included the class in both places and wrapped it in a "class exists" check. Like ...


0

The only free solution that I know of is WP Updater. However, this only handles automatic updates for plugins that are self-hosted. It does not handle any product sales or license keys.


0

It's not related to WordPress, but basic PHP understanding. But I'm answering to provide you the hint. You're doing the thing. Just embrace the whole div with the conditional: <?php $image = get_field('headOfDepartment_pic'); ?> <?php if( $image ) : ?> <div> <img src="<?php echo $image['url']; ?>" alt="<?php echo ...


0

You'd use roles for this. You'd create a new role that has the required access and then assign anyone you want to be in that role 'group'. The User Role Editor plugin should give you the functionality you need to create the access you require.


0

I´m using this code to get translated my themes: add_action('after_setup_theme', 'my_theme_setup'); function my_theme_setup(){ load_theme_textdomain('lc_realty', get_template_directory() . '/languages'); } the files are named ru_RU.mo and ru_RU.po I have no problems with this code on versions 3.3.1 to 3.8.3 I will upgrade to 4.0 soon son I hope this ...


1

I found the problem. I didn't realize this was a generic message for pretty much all errors. I stripped everything out of the activation routine (similar to above) and ran it... got no errors. Started adding "stuff" back. And it appears a call to flush() at the end of the activation function trying to force the /wp-content/debug.log to be flushed to disk was ...


0

You have a typo on this line: register_deactivaction_hook( __FILE__, 'my_plugin_deactivation'); It should be: register_deactivation_hook( __FILE__, 'my_plugin_deactivation');


0

The approach is pretty much sound, this is how these things work in WordPress. You might want to use add_rewrite_enpoint() for implementation though, since it compresses multiple steps into on integrated call and fits many use cases well.


0

A good place to start might be to take a look at the Google Map Field from Advanced Custom Fields. This suggestion requires a little more legwork than an pre-built plugin, but along with the Repeater Field, would allow you to query all the posts containing custom fields of that type, and generate a map with all the locations on it. Since your question asks ...


0

You get the current language of the install with the function get_locale(). WordPress save the language in theoptions table, option_name is WPLANG. But inside the Multisite install is in the table sitemeta. But is not important. You should use the default functions to load a language file inside the theme template or the plugin. Theme: ...


2

Since this is a plugin, it's probably going to get axed, but generally speaking in WordPress if you want to get a posts featured image and you have access to the post ID (which I'm assuming you do), you can always do this: $thumb_url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); So without looking at the plugin, it looks like you might ...


0

This is the closest I've been able to get, but if anyone has any other ideas, that would be great. I don't have a firm grasp on the Backbone part of WP just yet, and have never used it, so I'm not sure extending entire objects is the way to override default functionality. Any feedback would be helpful. /** * Replace the 'insert media into post' frame with ...


1

The way WordPress uses to find a plugin in repository is not public AFAIK. As per Otto answer in question you linked it involves plugin url header alongside plugin name. BTW, remove the plugin from the list of plugin to update is the best way to ensure this problem is not going to happen again: once the matching method is not public you can't know if it is ...


0

Found a great solution. Basically, you can check if an option name exists and if it already exists you don't insert your data. The main idea is, each time your database schema changes and requires an update on your user’s database, you need to increment the DB_VER by 1, then write a database upgrade routine for the current DB_VER. This would create some ...


0

If you're porting your WP db from one URL structure, you will come across issues where absolute paths, such as image urls will no longer work. One solution is to export the DB from the old site, open it in a an editor and do a search replace like so: "your-oldsite.com/wordpress/whatever" to "Your-new-site.com/" . And then import the DB into the new ...


1

Are you checking the slow query log in mysql or connection count? Just off the top of my head I would say mysql might be choking on something. Also, top can show you which processes are going crazy when this happens. Here is a bit on the slow query log and different ways to access its information: https://rtcamp.com/tutorials/mysql/slow-query-log/


0

This is due to a setting that controls the number of posts displayed per page. Check your admin settings. Go to Settings, Choose "Reading", Look at "Blog Pages Show At Most". The value there determines the default number of posts that are displayed per page. This defaults to 10 for new installations. Some themes also have a separate setting that is used ...


0

Add a check when the plugin is activated to see if the data(column/table) already exists in db or not ? If the data aldready exists then skip the db part and just mark the plugin as active.


0

Be sure you are executing wp_head() and wp_footer(). From the description of your problem I think you have remove wp_footer() when you have remove the footer content. wp_head() should be executed between <head> and </head>. wp_footer() should be executed before closing the </body>. Both functions are used to enqueue/print scripts.


0

You could do it with wp_login_form, something like this if ( ! is_user_logged_in() and <any-other-condition>){ $args = array( 'echo' => false, 'redirect' => esc_url($_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]), 'label_username' => __( 'Username' ), 'label_password' => __( 'Password' ...


2

You can generate output conditionally with trivial is_user_logged_in() check in template.


0

Registered styles are in the $wp_styles global, and registered scripts are in $wp_scripts. You can var_dump them to see their structure. global $wp_scripts; echo $wp_scripts->registered['tt-easy-google-fonts']->src;


0

At this URL http://www.bestwpthemez.com/wordpress/case-study-rss-error-wp-http-error-name-lookup-timed-out-wordpress-blog-3461/ , solution 2 is what solved my problem


0

Actually, just doing this check fixed this issue. if(wp_validate_auth_cookie()==FALSE) { wp_set_auth_cookie($userid, true, false); } seems to have fixed this issue. @here,your proposed solution didn't work for me and just redirected me to login page when trying to get into dashboard


0

In the end i went ahead and changed all my code according to several examples i found across the web. p.s i came to the conclusion my code is ok but isnt suitable for the accepted structered that needs to be used for ajax inside wp-admin. In any case... Here is a version that works. in the hope this might helps someone The JS ...


1

Looks like we both missed the error because I didn't see it at first either. In your call to add_meta_box you skipped the argument for context and went straight to priority. "high" is not an available string for the context argument, and this apparently causes the function to silently fail. Adding in the string for context fixes it: add_meta_box( ...


1

I suggest just making a new Post Type with the default Wordpress register_post_type(). function create_my_post_type() { $labels = array( 'name' => __( 'Providers pricing', 'myplugin_namespace' ), 'singular_name' => __( 'Provider pricing', 'myplugin_namespace' ), 'menu_name' => __( 'Provider Pricing', ...


0

I'd try changing the order of your rules. Once the default WP rules run, your URL will be rewritten and your last rule won't work. SetEnv no-gzip dont-vary RewriteEngine On RewriteRule ^produse/piese-schimb-utilaje-agricole/([0-9]+)/?$ ...


0

The conditional needs to test against strings which would be the name of the shortcode. If you're looking for the [hello] shortcode the conditional would look like: echo '<pre>'; print_r( $shortcode_tags['hello'] ); echo '</pre>'; So if you use add_shortcode() the string you'll be looking for is the first parameter: $tag.


1

Use Git for your local installation (example). Then create a remote all with multiple URLs, one for each site. When you want to update the sites, just type: git push all --all


0

You can add COOKIE with php or jQuery. And count this. Only refleshing or changing page you will update your COOKIE. And if cookie >= your_limit alert_or_redirect_now For more security you can add this cookie data to your database.


1

http://php.net/manual/en/function.preg-replace.php preg_replace expects your first parameter to be a pattern. Try a simple replace: $item = str_replace( array('.',' '), array('-','-'), strtolower($item));


1

Very old, but this still come up when searching, so I will add that my article WooCommerce Customize Checkout Fields here is a sample of adding a new checkout field: // Add a new checkout field function kia_filter_checkout_fields($fields){ $fields['extra_fields'] = array( 'some_field' => array( 'type' => 'text', ...


0

As you're using a VPS with SSH access, give WP-CLI a try http://wp-cli.org/ can work wonderfully http://centminmod.com/nginx_configure_wordpress_ffpc_plugin.html#installwp for example to install limit login attempts plugin just run this command from SSH within your wordpress install directory wp plugin install limit-login-attempts --activate --allow-root ...


0

anybody that looking for solution here is what i found that work for me. to get some data from any field in profile page you need to use this function: <?php get_the_author_meta( $field, $userID ); ?> then if you want to update some value in theme customizer you can use this function: set_theme_mod( 'field name', '$value' );


0

This is probably just a symptom of the problem of a failed install. If you look at that actual folder on the server it'll probably be a couple folders, but no php files and a bunch of missing files that are in the plugin zip. Maybe something failing on unzip, or ftp, caused half-installed state of not having the main php file. There are long-standing bugs ...


3

While this question is probably technically off topic since it relates to woo, there's definitely some stuff that could be answered that will help other users in the future, plus, I really have been there with the multi-day frustration stuff and would have killed for a life line. There's a few things at play here, what you're looking at in the code you ...


1

You could insert the logos as a gallery into the post content and write the gallery output on your own. add_filter( 'post_gallery', 'your_gallery_output_function', 10, 2 ); function your_gallery_output_function( $output, $attr ) { global $post; $args = array( 'post_type' => 'attachment', 'post_status' => 'inherit', ...


2

Grid of customer logos that link to their respective websites/success case posts. The site owner should be able to add or remove these at ease. Well I think the easiest way would to create a Custom Post Type called "Customer Logos". After that you could handle content and images multiple ways: More Precise Control but More Work Create an image size ...


0

This can be done a lot easier. It is just necessary to change the permalinks settings accordingly - as mentioned on github at the issue 3145: Meet this criteria: // If permalinks contain the shop page in the URI prepend the breadcrumb with shop if ( $shop_page_id && strstr( $permalinks['product_base'], '/' . $shop_page->post_name ) ...


0

I've discovered this can also happen if a check_admin_referer() function is being called with invalid arguments somewhere in your site. If you're getting this error and cant find the problem, check your use of check_admin_referer() throughout your theme and plugins. I started getting this error right after I created a new admin options page for my theme. I ...


3

I commit all WordPress because I consider it one big ball of code that pertains to one site, this means updates to core WordPress files, plugins and themes are all part of the commit history. I don't use sub-modules or any other weird nested revision setups. If you have a complicated structure of including multiple repos, I suggest keeping them separate and ...



Top 50 recent answers are included