PHP basics help in WP context – remove a class/function?
(Disclaimer: I am a designer by choice and a programmer only by necessity. Meaning I can somewhat read PHP code, but I have a harder time writing it myself. I wish I could be better though, and this post is an attempt at understanding PHP a bit better. I probably don’t know enough to ask this question in theright way or even using the right terms, so please bear with me. )
I have a custom post type plugin that is adding some custom fields to the admin screens, including a video meta box field. Now I need to remove the video field, and I’m wondering if you can do that fairly easy with some sort of clever unset/unregister/remove function?
I think I have identified the relevant piece of code from the plugin, but of course I don’t want to edit the plugin itself – but rather add some code in a functions file or similar. Can you give me some pointers in the right direction?
<?php
/**
* Class SixTenPressSermonsCustomFields
*/
class SixTenPressSermonsCustomFields extends SixTenPressCustomFields {
/* shortened for sake of the question */
/**
* Define the custom sermon fields.
* @return array
*/
protected function get_file_fields() {
$this->setting = sixtenpresssermons_get_setting();
return array(
array(
'type' => 'file',
'setting' => 'mp3',
'label' => __( 'Audio', 'sixtenpress-sermons' ),
'description' => __( 'Upload the audio file (MP3 format) or paste the URL for external MP3 (eg, SoundCloud).', 'sixtenpress-sermons' ),
'library' => array( 'audio' ),
),
array(
'type' => 'file',
'setting' => 'video',
'label' => __( 'Video', 'sixtenpress-sermons' ),
'description' => __( 'Upload the video file (MP4 format) or paste the URL for external video (YouTube, Vimeo).', 'sixtenpress-sermons' ),
'library' => array( 'video' ),
),
array(
'type' => 'file',
'setting' => 'file',
'label' => __( 'File', 'sixtenpress-sermons' ),
'description' => __( 'Upload a related file (pdf format). This could be sermon notes or a weekly bulletin.', 'sixtenpress-sermons' ),
'library' => array( 'application' ),
),
);
}
Can I use something in the functions.php file to remove the video field above? Like maybe:
<?php
function remove_video_field() {
/* not working, just guessing */
unset( sixtenpresssermons_get_setting );
/*specify Video option here somehow? */
}
add_action('remove_video_field','SixTenPressSermonsCustomFields');
// also not working, just me guessing here
Leave an answer