WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#7008 closed feature request (wontfix)

CUSTOM_OPTION_TABLE is there any possibility?

Reported by: link2caro Owned by:
Milestone: Priority: high
Severity: normal Version: 2.6.1
Component: Optimization Keywords: dev-feedback has-patch tested
Focuses: Cc:

Description

if ( defined('CUSTOM_OPTION_TABLE') )

$this->options = CUSTOM_OPTION_TABLE;

Is there any possibility to put this into the function set_prefix($prefix)?

I've been thinking about this so as to avoid the enabled plugins for certain theme, e.g. making an iPhone version would be much simpler if using another options set rather than trying to detect iPhone than turn off unnecessary plugins.

Thank you.

Attachments (1)

7008.diff (911 bytes) - added by Denis-de-Bernardy 5 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 link2caro6 years ago

  • Milestone changed from 2.9 to 2.7
  • Priority changed from normal to high
  • Version changed from 2.5.1 to 2.6.1

Please?

Just a line in wp-db.php?

comment:2 DD326 years ago

  • Keywords dev-feedback added

comment:3 link2caro6 years ago

I've just checked the wp_options and saw blog_id, is it that WP will have many option sets in wp_options in future?

If yes, this ticket is closed.

comment:4 DD326 years ago

blog_id is only used by WordPress MU AFAIK.

You could try globalising $blog_id and setting it to a diffferent value in your config file, I cant remember if get_option respects the blog_id in normal WP, Worth checking though.

comment:5 ryan6 years ago

  • Milestone changed from 2.7 to 2.8

comment:6 jacobsantos5 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.8 to 2.9
  • Type changed from enhancement to feature request

No.

I'm just kidding. Create a patch.

Denis-de-Bernardy5 years ago

comment:7 Denis-de-Bernardy5 years ago

  • Keywords has-patch tested added; needs-patch removed

Patch attached, but I'm curious to understand how it actually helps in any meaningful way.

Specifically, I take it that you want to add a condition in the wp-config file based on the user-agent. But what's really needed is a means to flush the filters altogether.

For this, you could hook onto plugins_loaded, and do something like:

global $wp_filters;
$wp_filters = array(); // or reset the ones that bother you, such as the_title and the_content
include the default filters file
and then add your own based on the user agent...

so has patch, but suggesting invalid for this reason.

comment:8 Denis-de-Bernardy5 years ago

  • Milestone changed from 2.9 to 2.8

comment:9 ryan5 years ago

  • Milestone 2.8 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

You want to avoid loading active plugins? If so that would be much better done with a define to avoid loading them versus loading an entire other table.

comment:10 link2caro5 years ago

  • Resolution wontfix deleted
  • Status changed from closed to reopened

Uhm, I've been searching how to disable active plugins but can't find the right thing yet, can you tell me how? as I see active plugins are includes in wp-settings, and there is no constant to avoid this to be happened.

Many thanks in advance.

(I made it reopened so that you can notice it? sorry if it annoys you :-) )

comment:11 Denis-de-Bernardy5 years ago

  • Resolution set to wontfix
  • Status changed from reopened to closed

you wouldn't want to disable them. rather, you'd proceed as described here:

http://core.trac.wordpress.org/ticket/7008#comment:7

It's like... if I've a plugin that modifies the loop, it should remain active on the ipod, no? What you really need is to remove all of the filters on the hooks that bother you, such as the_title and the_content.

comment:12 link2caro5 years ago

Uhm, let me explain my case:

I have a plugin which includes some sorts of javascripts, and I don't want to use full-featured version for ipod, like that. (So I don't want to disable but to force it not to be loaded, the plugin(s) itself stays active/enabled)

I have (in plugin file)
add_action('wp_footer', 'action_name');

I tried (in theme's functions.php)
remove_action('wp_footer', 'action_name');

But failed :( can you show me how should I remove the action?

And is there a way to know all actions/filters hooked by plugins, or I have to look into each plugin?

comment:13 link2caro5 years ago

I forgot, I got it work with remove_all_actions/filters.

comment:14 Denis-de-Bernardy5 years ago

in that case, use:

unset($GLOBALS['wp_filter'][$hook[]);

It's a barbarian means to achieve things, but it works.

comment:15 Denis-de-Bernardy5 years ago

getting very late... this even:

unset($GLOBALS['wp_filter'][$hook]);

comment:16 follow-up: link2caro5 years ago

many thanks, Denis-de-Barnardy :-)

I got it work with remove_action, I did not well consult the doc and missed the priority thingy. But it is really barbarian to get all the actions/filters that were hooked by plugins.

--

Anyway the idea of CUSTOM_OPTION_TABLE is not bad regarding themes and plugins, why is there CUSTOM_USER_TABLE but not CUSTOM_OPTION_TABLE ? Some sites would love to have both to better differentiate, customize two or many sites with same content.

Just a suggestion, no harm to have a CUSTOM_OPTION_TABLE anyway :-)

comment:17 in reply to: ↑ 16 Denis-de-Bernardy5 years ago

Replying to link2caro:

Anyway the idea of CUSTOM_OPTION_TABLE is not bad regarding themes and plugins, why is there CUSTOM_USER_TABLE but not CUSTOM_OPTION_TABLE ? Some sites would love to have both to better differentiate, customize two or many sites with same content.

those are to share users tables across WP installs.

comment:18 link2caro5 years ago

CUSTOM_OPTION_TABLE is to share WP install with many sites, just a flexibility that does not harm :-)

If it won't make it, no big deal anyway :-)

Note: See TracTickets for help on using tickets.